zhaojunkai
Showing 74 changed files with 781 additions and 545 deletions
... ... @@ -2,46 +2,30 @@ import { StringUtils } from './StringUtils';
import { SPHelper } from './SPHelper';
import { Logger } from './Logger';
const KEY_USER_TOKEN = 'userToken';
const TAG: string = 'AccountManagerUtils';
// 是否已登录hadLogin
let hasLogin: boolean = false;
export class AccountManagerUtils {
// 是否已登录hadLogin
// private static hasLogin: boolean = undefined;
// 这里需要和其他模块value值一致 !!!!
// TODO: 以前清楚谁写的遗留代码,后续考虑删除
static readonly USER_ID = "userId"
constructor() {
}
static async getUserToken(): Promise<string> {
let userToken = await SPHelper.default.get(KEY_USER_TOKEN, '') as string;
static async getUserId(): Promise<string> {
let userId = await SPHelper.default.get(AccountManagerUtils.USER_ID, '') as string;
// Logger.info(TAG, 'getUserToken UserToken.' + userToken);
return userToken;
return userId;
}
static getUserTokenSync(): string {
let userToken = SPHelper.default.getSync(KEY_USER_TOKEN, '') as string;
static getUserIdSync(): string {
let userId = SPHelper.default.getSync(AccountManagerUtils.USER_ID, '') as string;
// Logger.info(TAG, 'getUserToken UserToken.' + userToken);
return userToken;
}
static async putUserToken(value: string) {
await SPHelper.default.save(KEY_USER_TOKEN, value);
}
static putUserTokenSync(value: string) {
SPHelper.default.saveSync(KEY_USER_TOKEN, value);
}
static async deleteUserToken() {
await SPHelper.default.delete(KEY_USER_TOKEN);
}
static deleteUserTokenSync() {
SPHelper.default.deleteSync(KEY_USER_TOKEN);
return userId;
}
/**
... ... @@ -51,7 +35,7 @@ export class AccountManagerUtils {
*/
static async isLogin() {
Logger.info(TAG, 'isLogin hasLogin1:' + hasLogin);
let lastUserToken = await AccountManagerUtils.getUserToken()
let lastUserToken = await AccountManagerUtils.getUserId()
Logger.info(TAG, 'isLogin lastUserToken:' + lastUserToken);
if (StringUtils.isEmpty(lastUserToken)) {
hasLogin = false;
... ... @@ -72,7 +56,7 @@ export class AccountManagerUtils {
*/
static isLoginSync() {
Logger.info(TAG, 'isLogin hasLogin1:' + hasLogin);
let lastUserToken = AccountManagerUtils.getUserTokenSync()
let lastUserToken = AccountManagerUtils.getUserIdSync()
Logger.info(TAG, 'isLogin lastUserToken:' + lastUserToken);
if (StringUtils.isEmpty(lastUserToken)) {
hasLogin = false;
... ...
... ... @@ -37,6 +37,7 @@ export abstract class BasicDataSource<T> implements IDataSource {
})
}
// 通知控制器数据增加
public notifyDataAdd(index: number): void {
this.listeners.forEach(listener => {
... ...
... ... @@ -82,4 +82,20 @@ export class DeviceUtil {
static getRandomUUIDForTraceID(): string {
return util.generateRandomUUID().toUpperCase().replace(/-/g, '')
}
/**
* 是否为phone设备(可折叠手机即便完全展开状态也返回true)
* @returns
*/
static isPhone(): boolean {
return deviceInfo.deviceType == 'phone' || deviceInfo.deviceType == 'default';
}
static isNotPhone(): boolean {
return !DeviceUtil.isPhone();
}
static isTablet(): boolean {
return deviceInfo.deviceType == 'tablet';
}
}
... ...
... ... @@ -255,6 +255,7 @@ export class LazyDataSource<T> extends BasicDataSource<T> {
this.replaceAll()
}
// 把数据全部删除,再添加全部新元素
public replaceAll(...items: T[]): void {
// 从数组中的0位置开始删除dataArray.length个元素,并在同一位置插入((1个或多个))新元素,返回已删除的元素。
... ... @@ -262,6 +263,8 @@ export class LazyDataSource<T> extends BasicDataSource<T> {
this.notifyDataReload()
}
// 获取指定元素的下标
public getIndexOf(element: T): number {
for (let index = 0; index < this.dataArray.length; index++) {
... ... @@ -293,4 +296,13 @@ export class LazyDataSource<T> extends BasicDataSource<T> {
public reloadData(): void {
this.notifyDataReload();
}
//**********************//////////
public clearAllData(){
this.dataArray = []
this.notifyDataReload();
}
}
\ No newline at end of file
... ...
... ... @@ -18,7 +18,6 @@ export function handleJsCallAppService(data: Message, callback: (res: string) =>
if (queryString) {
url = url + `?${queryString}`
}
console.log('yzl', queryString, url)
WDHttp.get(url).then((res) => {
callback(JSON.stringify({
netError: '0',
... ...
... ... @@ -10,73 +10,74 @@
/*
信息流广告素材解析累
*/
export interface CompAdvMatInfoBean {
export class CompAdvMatInfoBean {
id:number = 0
/**
* 广告标题
*/
advTitle: string
advTitle: string = ''
/**
* 3:信息流广告
*/
advType: string
advType: string =''
/**
* 信息流广告类型(4:轮播图 5:三图广告 6:小图广告 7:长通栏广告 8:大图广告 9:视频广告 10:展会广告 11:冠名广告 12:顶部长通栏广告)
*/
advSubType: number
advSubType: number = 0
/**
* 素材图片信息;adv_subtype=4,5,6,7,8,9,12 时使用
*/
matImageUrl: string[]
matImageUrl: string[] = []
/**
* 视频广告地址(adv_subtype=9)
*/
matVideoUrl: string
matVideoUrl: string = ''
/**
* 扩展信息:advSubType=10,11时使用,字段示例见接口备注。
*/
extraData: string
extraData: string = ''
/**
* 链接类型: 0:无链接;1:内链(文章);2:外链
*/
linkType: string
linkType: string = ''
/**
* 链接跳转类型 :0-没链接,不用打开,1-端内打开,2-端外打开
*/
openType: string
openType: string = ''
/**
* 广告跳转链接
*/
linkUrl: string
linkUrl: string = ''
/**
* 素材类型(0:图片 1:视频)
*/
matType: string
matType: string = ''
/**
* 开屏样式(1:全屏样式 0:底部固定Logo)
*/
startStyle: string
startStyle: string = ''
}
/**
* 信息流广告位
*/
export interface CompAdvSlotInfoBean {
export class CompAdvSlotInfoBean {
/**
* 组件id
*/
compId: string;
compId: string = '';
/**
* 广告位位置 从1开始
*/
position: number;
position: number = 0;
/**
* 频道id
*/
channelId: string;
channelId: string = '';
}
\ No newline at end of file
... ...
import { CompAdvMatInfoBean } from '../adv/CompAdvInfoBean';
import { AudioDTO } from '../content/AudioDTO';
import { ContentDTO } from '../content/ContentDTO';
export interface BaseDTO {
... ...
... ... @@ -4,48 +4,88 @@ import { ContentDTO } from '../content/ContentDTO';
import { BaseDTO } from './BaseDTO';
@Observed
export class CompDTO implements BaseDTO{
backgroundColor: string='';
backgroundImgUrl: string='';
cityCode: string='';
compStyle: string='';
compType: string='';
export class CompDTO implements BaseDTO {
backgroundColor: string = '';
backgroundImgUrl: string = '';
cityCode: string = '';
compStyle: string = '';
compType: string = '';
// dataSourceRequest: any[];
districtCode: string='';
districtCode: string = '';
extraData?: string;
hasAdInfo: number=-1;
id: number=0;
imgSize: string='';
innerUrl: string='';
linkUrl: string='';
hasAdInfo: number = -1;
id: number = 0;
imgSize: string = '';
innerUrl: string = '';
linkUrl: string = '';
// meddleDataList: any[];
name: string='';
objectId: string=''; // 跳转页面id?
objectTitle: string=''; // comp标题
name: string = '';
objectId: string = ''; // 跳转页面id?
objectTitle: string = ''; // comp标题
// objectType?: string; // 跳转类型,枚举:
operDataList: ContentDTO[]=[]; // 运营数据列表【正常运营配置的强运营数据,部分推荐场景的配置(自动源兜底数据)】
operDataList: ContentDTO[] = []; // 运营数据列表【正常运营配置的强运营数据,部分推荐场景的配置(自动源兜底数据)】
// pageId?: any;
posterSize: string='';
posterUrl: string='';
provinceCode: string='';
sortValue: number=-1;
subType: string='';
imageScale: number=-1; // 封面图比例 1-4:3, 2-16:9, 3-3:2
audioDataList: AudioDTO[]=[];
titleShowPolicy: string | number='';
posterSize: string = '';
posterUrl: string = '';
provinceCode: string = '';
sortValue: number = -1;
subType: string = '';
imageScale: number = -1; // 封面图比例 1-4:3, 2-16:9, 3-3:2
audioDataList: AudioDTO[] = [];
titleShowPolicy: string | number = '';
/**
* 组件内容源类型 (LIVE_HORIZONTAL_CARD\LIVE_RESERVATION\LIVE_LARGE_CARD\LIVE_END\LIVE_MONTHLY_RANKING )
*/
dataSourceType: string='';
dataSourceType: string = '';
/**
* 信息流广告素材
*/
matInfo: CompAdvMatInfoBean = {} as CompAdvMatInfoBean
matInfo: CompAdvMatInfoBean = new CompAdvMatInfoBean
pageId?: string;
objectType?: string;
hasMore: number = 1
// keyGenerator相关字符串,用于刷新list布局
timestamp: String = '1'
/**
* 创建新的compbean对象
* @param old
* @returns
*/
static createNewsBean(old: CompDTO): CompDTO {
let comp: CompDTO = new CompDTO
comp.compStyle = old.compStyle
comp.compType = old.compType
comp.operDataList = old.operDataList
comp.extraData = old.extraData
comp.matInfo = old.matInfo
comp.backgroundColor = old.backgroundColor
comp.backgroundImgUrl = old.backgroundImgUrl
comp.cityCode = old.cityCode
comp.districtCode = old.districtCode
comp.provinceCode = old.provinceCode
comp.hasAdInfo = old.hasAdInfo
comp.id = old.id
comp.imgSize = old.imgSize
comp.innerUrl = old.innerUrl
comp.linkUrl = old.linkUrl
comp.name = old.name
comp.objectId = old.objectId
comp.objectTitle = old.objectTitle
comp.posterSize = old.posterSize
comp.posterUrl = old.posterUrl
comp.sortValue = old.sortValue
comp.subType = old.subType
comp.imageScale = old.imageScale
comp.audioDataList = old.audioDataList
comp.titleShowPolicy = old.titleShowPolicy
comp.pageId = old.pageId
comp.extraData = old.extraData
comp.dataSourceType = old.dataSourceType
comp.objectType = old.objectType
comp.hasMore = old.hasMore
return comp
}
}
\ No newline at end of file
... ...
/**
* 批查接口查询互动相关数据,返回数据bean
*/
@Observed
export class InteractDataDTO {
collectNum: number | string = 0;
commentNum: number | string = 0;
... ...
... ... @@ -25,34 +25,35 @@ import { SearchContentComponent } from './cardview/SearchContentComponent';
@Component
export struct CardParser {
@State contentDTO: ContentDTO = new ContentDTO();
@State compDTO: CompDTO = {} as CompDTO
@ObjectLink compDTO: CompDTO
build() {
this.contentBuilder(this.contentDTO, this.compDTO);
this.contentBuilder(this.contentDTO);
}
@Builder
contentBuilder(contentDTO: ContentDTO, compDTO: CompDTO) {
contentBuilder(contentDTO: ContentDTO) {
// Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO })
if (!!contentDTO.contentText) {
SearchContentComponent({ contentDTO })
} else {
if (contentDTO.appStyle === CompStyle.Card_02) {
Card2Component({ contentDTO })
Card2Component({ compDTO: this.compDTO, contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_03) {
Card3Component({ contentDTO })
Card3Component({ compDTO: this.compDTO, contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_04) {
Card4Component({ contentDTO })
Card4Component({ compDTO: this.compDTO, contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_05) {
Card5Component({ contentDTO, titleShowPolicy: compDTO.titleShowPolicy })
Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy })
} else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle
.Card_13) {
Card6Component({ contentDTO })
Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_09) {
Card9Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_10) {
Card10Component({ contentDTO })
Card10Component({ compDTO: this.compDTO, contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_11) {
Card11Component({ contentDTO })
Card11Component({ compDTO: this.compDTO, contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_12) {
Card12Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_14) {
... ... @@ -62,7 +63,7 @@ export struct CardParser {
} else if (contentDTO.appStyle === CompStyle.Card_16) {
Card16Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_17) {
Card17Component({ contentDTO })
Card17Component({ compDTO: this.compDTO, contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_19) {
Card19Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_20) {
... ... @@ -77,6 +78,5 @@ export struct CardParser {
// .backgroundColor(Color.Brown) // 展示本页未实现的compStyle
}
}
}
}
\ No newline at end of file
... ...
import { CompDTO } from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant';
import { LabelComponent } from './view/LabelComponent';
import { CommonConstants, CompStyle } from 'wdConstant/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import PageModel from '../viewmodel/PageModel';
import { CardParser } from './CardParser';
import { Card2Component } from './cardview/Card2Component';
import { Card5Component } from './cardview/Card5Component';
import { AdvCardParser } from './cardViewAdv/AdvCardParser';
import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01';
import { ZhGridLayout02 } from './compview/ZhGridLayout02';
import { ZhGridLayout03 } from './compview/ZhGridLayout03';
import { ZhSingleColumn04 } from './compview/ZhSingleColumn04';
import { ZhSingleColumn05 } from './compview/ZhSingleColumn05';
import { ZhSingleColumn09 } from './compview/ZhSingleColumn09';
import { ZhSingleRow02 } from './compview/ZhSingleRow02';
import { ZhSingleRow03 } from './compview/ZhSingleRow03';
import { ZhSingleRow04 } from './compview/ZhSingleRow04';
import { ZhSingleRow06 } from './compview/ZhSingleRow06';
import {
HorizontalStrokeCardThreeTwoRadioForMoreComponent
} from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent';
import {
HorizontalStrokeCardThreeTwoRadioForOneComponent
} from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
import { ZhSingleRow02 } from './compview/ZhSingleRow02';
import { ZhSingleRow03 } from './compview/ZhSingleRow03';
import { ZhSingleRow04 } from './compview/ZhSingleRow04';
import { ZhSingleRow06 } from './compview/ZhSingleRow06';
import { ZhSingleColumn04 } from './compview/ZhSingleColumn04';
import { ZhSingleColumn09 } from './compview/ZhSingleColumn09';
import { ZhGridLayout03 } from './compview/ZhGridLayout03';
import { CardParser } from './CardParser';
import { ZhGridLayout02 } from './compview/ZhGridLayout02';
import { Card2Component } from './cardview/Card2Component';
import { Card5Component } from './cardview/Card5Component';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { AdvCardParser } from './cardViewAdv/AdvCardParser';
import PageModel from '../viewmodel/PageModel';
import { LabelComponent } from './view/LabelComponent';
import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent';
import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01';
/**
* comp适配器.
* 首页楼层comp解析器.
*/
@Preview
@Component
export struct CompParser {
@State compDTO: CompDTO = {} as CompDTO
@ObjectLink compDTO: CompDTO
@State compIndex: number = 0;
@State private pageModel: PageModel = new PageModel();
... ... @@ -39,83 +39,89 @@ export struct CompParser {
Column() {
if (this.compDTO.name != "月度排行卡") {
this.componentBuilder(this.compDTO, this.compIndex);
this.componentBuilder();
}
}
}
@Builder
componentBuilder(compDTO: CompDTO, compIndex: number) {
//if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
if (compDTO.compStyle === CompStyle.Label_03) {
LabelComponent({ compDTO: compDTO })
componentBuilder() {
//CardParser({ contentDTO: this.compDTO.operDataList[0], compDTO:this.compDTO })
if (this.compDTO.operDataList[0]?.objectType !== '3' &&
this.compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
if (this.compDTO.compStyle === CompStyle.Label_03) {
LabelComponent({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
ZhCarouselLayout01({ compDTO: compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
ZhCarouselLayout01({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 &&
compDTO.imageScale === 2) { // && compDTO.name ==="横划卡"
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 &&
this.compDTO.imageScale === 2) { // && compDTO.name ==="横划卡"
LiveHorizontalCardComponent({ compDTO: compDTO })
LiveHorizontalCardComponent({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) {
if (compDTO.operDataList.length > 1) {
HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 && this.compDTO.imageScale === 3) {
if (this.compDTO.operDataList.length > 1) {
HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: this.compDTO })
} else {
HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO })
HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: this.compDTO })
}
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
ZhSingleRow02({ compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
ZhSingleRow02({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
ZhSingleRow03({ compDTO: compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
ZhSingleRow03({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) {
ZhGridLayout02({ compDTO: compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) {
ZhGridLayout02({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
ZhGridLayout03({ compDTO: compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
ZhGridLayout03({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) {
ZhSingleRow04({ compDTO: compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_04) {
ZhSingleRow04({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_05) {
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_05) {
// ZhSingleRow05({ compDTO })
// Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) {
ZhSingleRow06({ compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_06) {
ZhSingleRow06({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
//头图卡 和comStyle 2相同,
Card5Component({ contentDTO: compDTO.operDataList[0], titleShowPolicy: compDTO.titleShowPolicy })
Card5Component({ contentDTO: this.compDTO.operDataList[0], titleShowPolicy: this.compDTO.titleShowPolicy })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) {
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_03) {
// 大图卡
Card2Component({ contentDTO: compDTO.operDataList[0] })
Card2Component({ compDTO: this.compDTO, contentDTO: this.compDTO.operDataList[0] })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) {
ZhSingleColumn04({ compDTO: compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_04) {
ZhSingleColumn04({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) {
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_05) {
// ZhSingleColumn05({ compDTO: compDTO })
// Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_09) {
ZhSingleColumn09({ compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
AdvCardParser({ pageModel: this.pageModel, compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) {
Divider().strokeWidth(3).color('#ffffff').padding({ left: 16, right: 16 }).margin({top: -3})
Divider().strokeWidth(6).color('#f5f5f5')
ZhSingleColumn09({ compDTO: this.compDTO })
Divider().strokeWidth(6).color('#f5f5f5')
} else if (this.compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
AdvCardParser({ pageModel: this.pageModel, compDTO: this.compDTO })
//Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (!Number.isNaN(Number(compDTO.compStyle))) {
CardParser({ contentDTO: compDTO.operDataList[0], compDTO });
} else if (!Number.isNaN(Number(this.compDTO.compStyle))) {
CardParser({ contentDTO: this.compDTO.operDataList[0], compDTO: this.compDTO });
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else {
Text(compDTO.compStyle)
Text(this.compDTO.compStyle)
.width(CommonConstants.FULL_PARENT)
.padding(10)
.onClick(() => {
if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) { //精选评论
if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_06) { //精选评论
WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage)
}
})
... ... @@ -123,6 +129,5 @@ export struct CompParser {
}
}
// }
}
}
\ No newline at end of file
... ...
... ... @@ -70,6 +70,7 @@ export struct DynamicDetailComponent {
@State isPageEnd: boolean = false
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State reachEndIncreament: number = 0
@State operationButtonList: string[] = []
async aboutToAppear() {
await this.getContentDetailData()
... ... @@ -532,15 +533,7 @@ export struct DynamicDetailComponent {
if (this.contentDetailData?.openComment) {
Divider().strokeWidth(6).color('#f5f5f5').margin({ top: $r('app.float.margin_24') })
CommentComponent({
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
publishCommentModel: this.publishCommentModel
})
}
Blank().layoutWeight(1)
... ... @@ -557,7 +550,7 @@ export struct DynamicDetailComponent {
OperRowListView({
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
operationButtonList: ['comment', 'collect', 'share'],
operationButtonList: this.operationButtonList,
styleType: 1,
})
... ... @@ -574,13 +567,6 @@ export struct DynamicDetailComponent {
* */
private async getContentDetailData() {
this.isNetConnected = NetworkUtil.isNetConnected()
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
try {
let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType)
this.isPageEnd = true;
... ... @@ -590,6 +576,20 @@ export struct DynamicDetailComponent {
let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime)
console.log('动态详情', JSON.stringify(this.contentDetailData))
if (this.contentDetailData?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
}
this.operationButtonList = ['comment', 'collect', 'share']
} catch (exception) {
console.log('请求失败', JSON.stringify(exception))
this.isPageEnd = true;
... ...
... ... @@ -234,13 +234,13 @@ export struct ImageAndTextPageComponent {
}
if (this.contentDetailData?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
}
if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length &&
this.contentDetailData?.audioList[0].audioUrl) {
... ...
... ... @@ -23,7 +23,6 @@ export struct ImageAndTextWebComponent {
private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
private webPrepared = false;
private dataPrepared = false;
async onDetailDataUpdated() {
if (this.action) {
let contentId: string = ''
... ...
... ... @@ -21,6 +21,8 @@ import { effectKit } from '@kit.ArkGraphics2D';
import { window } from '@kit.ArkUI';
import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel';
import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel'
import { viewColumInsightIntentShare } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG = 'MorningEveningPaperComponent';
... ... @@ -126,6 +128,10 @@ export struct MorningEveningPaperComponent {
// let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId)
let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091"
this.pageInfoBean = pageInfoBean;
//早晚报意图上报
let context = getContext(this) as common.UIAbilityContext;
viewColumInsightIntentShare(context,String(dailyPaperTopicPageId), this.pageInfoBean)
this.title = this.pageInfoBean?.topicInfo?.title
let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN)
const dateShow = new Date(dateTime)
... ...
... ... @@ -445,13 +445,13 @@ export struct MultiPictureDetailPageComponent {
// }
if (this.contentDetailData?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
}
// this.contentDetailData.photoList = []
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
... ...
... ... @@ -72,13 +72,13 @@ export struct SpacialTopicPageComponent {
this.contentDetailData = detailBeans[0];
// if (this.contentDetailData[0]?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
// }
this.trySendData2H5()
}
... ...
import { ContentDTO } from 'wdBean'
import { CompDTO, ContentDTO } from 'wdBean'
import { CommonConstants } from 'wdConstant/Index';
import { DateTimeUtils } from 'wdKit/Index';
@Component
export struct CardSourceInfo {
@State contentDTO: ContentDTO = new ContentDTO();
@ObjectLink compDTO: CompDTO
build() {
Flex() {
... ... @@ -28,13 +29,14 @@ export struct CardSourceInfo {
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
// 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间
if (this.contentDTO.isSearch || this.contentDTO.isCollection || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime
if (this.contentDTO.isSearch || this.contentDTO.isCollection ||
!this.contentDTO.isSearch && DateTimeUtils.getCommentTime
(Number
.parseFloat(this
.contentDTO.publishTime))
.indexOf
('-') === -1) {
if(this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName || this
if (this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName || this
.contentDTO.rmhPlatform !== 1 && this.contentDTO.source) {
Image($r("app.media.point"))
.width(16)
... ... @@ -45,16 +47,30 @@ export struct CardSourceInfo {
.fontColor($r("app.color.color_B0B0B0"))
.flexShrink(0)
}
if (this.contentDTO?.interactData?.commentNum) {
Text(`${this.contentDTO.interactData.commentNum}评`)
if (this.getContentDtoBean()?.interactData?.commentNum) {
Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`)
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
.flexShrink(0)
.margin({ left: 6 })
.visibility(Number(this.contentDTO?.interactData?.commentNum) === 0 ? Visibility.None : Visibility.Visible)
.visibility(Number(this.getContentDtoBean()?.interactData?.commentNum) === 0 ? Visibility.None : Visibility.Visible)
}
}
.width(CommonConstants.FULL_WIDTH)
.margin({ top: 8 })
}
/**
* 获取稿件业务对象
* @returns
*/
private getContentDtoBean(): ContentDTO {
if (this.compDTO == undefined) {
return new ContentDTO
}
if(this.compDTO.operDataList.length == 0){
return new ContentDTO
}
return this.compDTO.operDataList[0]
}
}
\ No newline at end of file
... ...
... ... @@ -54,14 +54,13 @@ export struct CardAdvBottom {
let currentIndex = -1
for (let i = 0; i < this.pageModel.compList.size(); i++) {
let b = this.pageModel.compList.getData(i) as CompDTO
if (a.compStyle === b.compStyle && a.matInfo === b.matInfo) {
if (a.compStyle == b.compStyle && a.matInfo.id == b.matInfo.id) {
currentIndex = i
break;
}
}
if (currentIndex >= 0) {
this.pageModel.compList.deleteItem(currentIndex)
this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
}
}
}
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { CompDTO } from 'wdBean';
import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/AdvExtraData';
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardAdvTop } from './CardAdvTop';
const TAG: string = 'Card2Component';
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardAdvBottom } from './CardAdvBottom';
const TAG: string = 'Card2Component';
... ...
... ... @@ -73,7 +73,6 @@ export struct CardAdvTop {
}
if (currentIndex >= 0) {
this.pageModel.compList.deleteItem(currentIndex)
this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
}
}
}
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO, VideoInfoDTO } from 'wdBean';
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { CardAdvBottom } from './CardAdvBottom';
const TAG: string = 'Card2Component';
... ...
import { ContentDTO, slideShows, VideoInfoDTO } from 'wdBean';
import { ContentDTO, slideShows, VideoInfoDTO, CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
... ... @@ -16,6 +16,7 @@ const TAG: string = 'Card10Component';
export struct Card10Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@ObjectLink compDTO: CompDTO
@State titleMarked: boolean = false;
@State str01: string = '';
@State str02: string = '';
... ... @@ -133,8 +134,10 @@ export struct Card10Component {
.textIndent(item.objectType == '5' ? 38 : 0)
}.alignContent(Alignment.TopStart)
//bottom 评论等信息
CardSourceInfo(
{
compDTO: this.compDTO,
contentDTO: this.createContent(item)
}
)
... ...
//缩略标题
import { CompDTO, ContentDTO } from 'wdBean'
import { DateTimeUtils } from 'wdKit'
import { CommonConstants } from 'wdConstant';
import { ContentDTO } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
... ... @@ -14,6 +15,7 @@ const TAG = 'Card11Component';
export struct Card11Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State clicked: boolean = false;
@ObjectLink compDTO: CompDTO
@State titleMarked: boolean = false;
@State str01: string = '';
@State str02: string = '';
... ... @@ -35,7 +37,9 @@ export struct Card11Component {
build() {
Column() {
Stack() {
if (this.contentDTO.objectType == '5') {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags })
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text() {
... ... @@ -53,13 +57,15 @@ export struct Card11Component {
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.width(CommonConstants.FULL_WIDTH)
.textIndent(this.contentDTO.objectType == '5' ? 35 : 0)
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
(this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||
this.contentDTO.objectType == '5' ? 30 : 0)
}.alignContent(Alignment.TopStart)
// 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO })
}.width(CommonConstants.FULL_WIDTH)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
... ...
... ... @@ -13,10 +13,10 @@ const TAG = 'Card17Component';
*/
@Component
export struct Card17Component {
@State compDTO: CompDTO = {} as CompDTO
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
@ObjectLink compDTO: CompDTO
@State titleMarked: boolean = false;
@State str01: string = '';
@State str02: string = '';
... ... @@ -120,7 +120,7 @@ export struct Card17Component {
})
// 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
CardSourceInfo({compDTO:this.compDTO, contentDTO: this.contentDTO })
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ...
... ... @@ -2,7 +2,7 @@ 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 { CarderInteraction } from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG = 'Card19Component';
... ... @@ -72,9 +72,9 @@ export struct Card19Component {
}
return photo
})
ProcessUtils.gotoMultiPictureListPage(photoList,0)
ProcessUtils.gotoMultiPictureListPage(photoList, 0)
})
CarderInteraction({contentDTO: this.contentDTO})
CarderInteraction({ contentDTO: this.contentDTO })
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.padding({
... ... @@ -106,8 +106,8 @@ struct createImg {
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位
this.fullColumnImgUrls.splice(2,0, {
if (this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位
this.fullColumnImgUrls.splice(2, 0, {
fullUrl: ''
} as FullColumnImgUrlDTO)
}
... ... @@ -151,7 +151,6 @@ struct createImg {
}
}
build() {
GridRow({
gutter: { x: 2, y: 2 }
... ...
//全标题 "appStyle":"2",
import { ContentDTO } from 'wdBean';
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
... ... @@ -22,6 +22,7 @@ export struct Card2Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
@ObjectLink compDTO: CompDTO
@State titleMarked: boolean = false;
@State str01: string = '';
@State str02: string = '';
... ... @@ -90,7 +91,7 @@ export struct Card2Component {
//bottom
// 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO })
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ...
import { ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { CompDTO, ContentDTO } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
... ... @@ -12,6 +12,7 @@ import { Notes } from './notes';
export struct Card3Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State clicked: boolean = false;
@ObjectLink compDTO: CompDTO
@State titleMarked: boolean = false;
@State str01: string = '';
@State str02: string = '';
... ... @@ -34,7 +35,9 @@ export struct Card3Component {
build() {
Column() {
Stack() {
if (this.contentDTO.objectType == '5') {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags })
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text() {
... ... @@ -50,11 +53,13 @@ export struct Card3Component {
.fontSize($r("app.float.font_size_16"))
.fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222"))
.width(CommonConstants.FULL_WIDTH)
.textIndent(this.contentDTO.objectType == '5' ? 35 : 0)
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
(this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||
this.contentDTO.objectType == '5' ? 30 : 0)
}.alignContent(Alignment.TopStart)
// 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
CardSourceInfo({compDTO:this.compDTO, contentDTO: this.contentDTO })
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ...
import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
import { CompDTO, ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
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';
/**
... ... @@ -22,7 +23,7 @@ export struct Card4Component {
@State str01: string = '';
@State str02: string = '';
@State str03: string = '';
@ObjectLink compDTO: CompDTO
async aboutToAppear(): Promise<void> {
this.titleInit();
... ... @@ -96,7 +97,7 @@ export struct Card4Component {
ProcessUtils.processPage(this.contentDTO)
})
//bottom 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO })
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ...
... ... @@ -53,7 +53,9 @@ export struct Card5Component {
})
Row() {
Stack() {
if (this.contentDTO.objectType == '5') {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags })
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
... ... @@ -69,11 +71,13 @@ export struct Card5Component {
}
.width(CommonConstants.FULL_WIDTH)
.fontColor(Color.White)
.fontSize($r('app.float.normal_text_size'))
.fontSize($r('app.float.font_size_17'))
.fontWeight(FontWeight.Bold)
.maxLines(2)
.align(Alignment.TopStart)
.textIndent(this.contentDTO.objectType == '5' ? 35 : 0)
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
(this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||
this.contentDTO.objectType == '5' ? 30 : 0)
}.alignContent(Alignment.TopStart)
}
.justifyContent(FlexAlign.Start)
... ...
import { ContentDTO } from 'wdBean';
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants, CompStyle } 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';
// import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { Logger } from 'wdKit/Index';
const TAG: string = 'Card6Component-Card13Component';
... ... @@ -15,13 +14,14 @@ const TAG: string = 'Card6Component-Card13Component';
*/
@Component
export struct Card6Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
@State titleMarked: boolean = false;
@State str01: string = '';
@State str02: string = '';
@State str03: string = '';
@ObjectLink compDTO: CompDTO
@State contentDTO: ContentDTO = new ContentDTO();
async aboutToAppear(): Promise<void> {
this.titleInit();
... ... @@ -81,12 +81,12 @@ export struct Card6Component {
this.contentDTO.objectType == '5' ? 30 : 0)
}.alignContent(Alignment.TopStart)
}.height("75%")
}
.justifyContent(FlexAlign.Start)
//bottom 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
CardSourceInfo({ compDTO: this.compDTO,contentDTO:this.contentDTO })
}
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Start)
... ...
... ... @@ -61,6 +61,7 @@ export struct Card9Component {
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.height(133)
.borderRadius({
topLeft: $r('app.float.image_border_radius'),
topRight: $r('app.float.image_border_radius')
... ...
import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
import { CompDTO, ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
... ... @@ -61,7 +61,7 @@ export struct SearchContentComponent {
ProcessUtils.processPage(this.contentDTO)
})
//bottom 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
CardSourceInfo({compDTO:new CompDTO, contentDTO: this.contentDTO })
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ...
... ... @@ -93,6 +93,9 @@ export struct CommentComponent {
}
});
}
if (model) {
this.isComments = true
}
}
... ...
... ... @@ -190,6 +190,7 @@ export struct CommentIconComponent {
.width(this.getMeasureText(this.publishCommentModel.totalCommentNumer) +
12)// .backgroundColor(Color.Green)
.id("Text")
.visibility(this.publishCommentModel.totalCommentNumer ? Visibility.Visible : Visibility.Hidden)
// .offset({
// x: 3
// })
... ...
... ... @@ -164,7 +164,7 @@ class CommentViewModel {
publishComment(model: publishCommentModel) {
return new Promise<commentItemModel>((success, fail) => {
const visitorMode = model.visitorComment == "1" && AccountManagerUtils.isLoginSync() == false
const visitorMode = model.visitorComment == "1" && HttpUtils.isLogin() == false
let url = visitorMode ? HttpUrlUtils.getNoUserPublishCommentUrl() : HttpUrlUtils.getPublishCommentUrl()
let bean: Record<string, string> = {};
... ...
... ... @@ -55,7 +55,7 @@ export struct ZhGridLayout02 {
.width(CommonConstants.FULL_WIDTH)
GridRow({
gutter: { x: 12, y: 15 },
gutter: { x: 12, y: 13 },
columns: { sm: listSize, md: 2 },
breakpoints: { value: ['320vp', '520vp', '840vp'] }
}) {
... ... @@ -120,7 +120,7 @@ export struct ZhGridLayout02 {
}
Text(item.newsTitle)
.margin({ top: '5' })
.margin({top:'6'})
.fontSize(13)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
... ...
... ... @@ -59,12 +59,16 @@ export struct ZhGridLayout03 {
.backgroundColor(0xf5f5f5)
.width(44)
.aspectRatio(1 / 1)
.margin({
bottom: 16
})
// .margin({
// bottom: 16
// })
Text(item.newsTitle)
.fontSize(13)
.maxLines(1)
.margin({
top: 8,
bottom:11
})
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
.width('100%')
... ...
... ... @@ -9,6 +9,7 @@ import {
import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
import commentViewModel from '../../components/comment/viewmodel/CommentViewModel';
import { commentItemModel } from '../../components/comment/model/CommentModel'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
/**
* 精选评论卡
... ... @@ -22,9 +23,11 @@ export struct ZhSingleRow06 {
@State newsStatusOfUser: batchLikeAndCollectResult = {
likeStatus: '0'
} as batchLikeAndCollectResult // 点赞、收藏状态
@State loadImg: boolean = false;
aboutToAppear(): void {
async aboutToAppear(): Promise<void> {
this.getInteractDataStatus()
this.loadImg = await onlyWifiLoadImg();
}
/**
... ... @@ -160,7 +163,12 @@ export struct ZhSingleRow06 {
CompHeader(item: CompDTO) {
Row() {
Row() {
Image(item.operDataList[0]?.commentInfo?.userHeaderUrl ? item.operDataList[0].commentInfo.userHeaderUrl : $r('app.media.default_head'))
Image(
this.loadImg
? item.operDataList[0]?.commentInfo?.userHeaderUrl
? item.operDataList[0].commentInfo.userHeaderUrl
: $r('app.media.default_head')
: '')
.width(32)
.height(32)
.borderRadius(16)
... ...
... ... @@ -16,7 +16,7 @@ export struct MessageListUI {
aboutToAppear() {
this.msgData = MinePageDatasModel.getMessageData()
this.getHistoryPush()
// this.getHistoryPush()
this.getMessagePush()
}
... ... @@ -58,19 +58,7 @@ export struct MessageListUI {
if(value.subscribeCount > 0){
item.unReadCount = value.subscribeCount
}
} else if (item.title == "系统消息") {
if (value.systemInfo != null) {
if (value.systemInfo.title) {
item.desc = value.systemInfo.title
}
if (value.systemInfo.time) {
item.time = this.getPublishTime(value.subscribeInfo.time,DateTimeUtils.getDateTimestamp(value.systemInfo.time) + "")
}
}
if(value.systemCount > 0){
item.unReadCount = value.systemCount
}
}else if(item.title == "互动消息"){
} else if(item.title == "互动消息"){
if(value.activeCount > 0){
item.unReadCount = value.activeCount
}
... ... @@ -82,7 +70,19 @@ export struct MessageListUI {
item.time = this.getPublishTime(value.subscribeInfo.time,DateTimeUtils.getDateTimestamp(value.activeInfo.time) + "")
}
}
}/*else if (item.title == "系统消息") {
if (value.systemInfo != null) {
if (value.systemInfo.title) {
item.desc = value.systemInfo.title
}
if (value.systemInfo.time) {
item.time = this.getPublishTime(value.subscribeInfo.time,DateTimeUtils.getDateTimestamp(value.systemInfo.time) + "")
}
}
if(value.systemCount > 0){
item.unReadCount = value.systemCount
}
}*/
})
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
... ...
... ... @@ -117,7 +117,7 @@ struct BrowsingHistoryPage {
.margin({left:16})
}
Column() {
BigPicCardComponent({contentDTO:compDTO})
BigPicCardComponent({compDTO:new CompDTO,contentDTO:compDTO})
}
}
}
... ...
... ... @@ -27,7 +27,7 @@ struct EditUserInfoPage {
}
}),
alignment: DialogAlignment.Bottom,
offset:{dx:0,dy:-20}
offset:{dx:0,dy:-20},
})
aboutToAppear() {
... ... @@ -97,14 +97,14 @@ struct EditUserInfoPage {
Row(){
Text(r.title)
.fontSize(15)
.fontColor(Color.Gray)
.fontColor('#666666')
Blank()
Text(r.subTitle)
.textOverflow({overflow:TextOverflow.Ellipsis})
.maxLines(1)
.fontSize(14)
.fontColor(Color.Gray)
.fontColor(r.subTitle === '待完善'?'#999999':'#666666')
.padding({right:10})
.width('70%')
.textAlign(TextAlign.End)
... ...
... ... @@ -45,7 +45,7 @@ struct EditUserIntroductionPage {
Divider()
.margin(20)
Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多60个字,只能输入中文、数字、英文字母。')
Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多60个字,只能输入中文、数字、英文字母。')
.fontSize(13)
.padding(12)
.fontColor(Color.Gray).lineHeight(25)
... ... @@ -54,6 +54,8 @@ struct EditUserIntroductionPage {
.type(ButtonType.Normal)
.width('90%')
.backgroundColor('#ED2800')
.opacity(this.numCount === 0 ? 0.6 : 1)
.fontColor(this.numCount === 0 ? '#999999' : Color.White)
.borderRadius(5)
.margin(30)
.onClick(()=>{
... ...
... ... @@ -47,7 +47,7 @@ struct EditUserNikeNamePage {
Divider()
.margin(20)
Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多16个字,只能输入中文、数字、英文字母。')
Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多16个字,只能输入中文、数字、英文字母。')
.fontSize(13)
.padding(12)
.fontColor(Color.Gray).lineHeight(25)
... ... @@ -56,6 +56,8 @@ struct EditUserNikeNamePage {
.type(ButtonType.Normal)
.width('90%')
.backgroundColor('#ED2800')
.opacity(this.numCount === 0 ? 0.6 : 1)
.fontColor(this.numCount === 0 ? '#999999' : Color.White)
.borderRadius(5)
.margin(30)
.onClick(()=>{
... ...
... ... @@ -62,7 +62,7 @@ export struct MinePageComponent {
getMessageData(){
MinePageDatasModel.getMessageUnReadData().then((value) => {
if(value !=null) {
if(value.activeCount >0 ||value.subscribeCount > 0 || value.systemCount > 0){
if(value.activeCount >0 ||value.subscribeCount > 0 /*|| value.systemCount > 0*/){
this.personalData.forEach((value) => {
if(value.msg == "消息")
value.isShowRedPoint = true
... ...
... ... @@ -4,13 +4,14 @@ import PageModel from '../../viewmodel/PageModel';
import { CommonConstants, ViewType } from 'wdConstant'
import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent'
import { ErrorComponent } from '../view/ErrorComponent'
import { ContentDTO } from 'wdBean'
import { CompDTO, ContentDTO } from 'wdBean'
import NoMoreLayout from './NoMoreLayout'
import { CustomSelectUI } from '../view/CustomSelectUI';
import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI';
import { BigPicCardComponent } from '../view/BigPicCardComponent';
import { contentListItemParams } from '../../model/MyCollectionModel';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import { MyCustomDialog } from '../reusable/MyCustomDialog'
@Entry
@Component
... ... @@ -26,6 +27,19 @@ struct MyCollectionListPage {
@State currentPage: number = 1;
private scroller: Scroller = new Scroller();
dialogController: CustomDialogController = new CustomDialogController({
builder: MyCustomDialog({
confirm: () => {
this.deleteDatas()
},
titleShow:false,
tipValue: this.isAllSelect?'是否确认清空?':'确认删除'+this.deleteNum.toString()+'条收藏'
}),
autoCancel: true,
alignment: DialogAlignment.Center,
customStyle: true
})
aboutToAppear(){
this.getData()
}
... ... @@ -73,7 +87,7 @@ struct MyCollectionListPage {
this.allSelectDatas(isAllSelect)
},
confirmCallback:()=>{
this.deleteDatas()
this.dialogController.open()
}
})
}
... ... @@ -117,7 +131,7 @@ struct MyCollectionListPage {
.margin({left:16})
}
Column() {
BigPicCardComponent({contentDTO:compDTO})
BigPicCardComponent({compDTO:new CompDTO,contentDTO:compDTO})
}
}
}
... ...
... ... @@ -14,7 +14,9 @@ import PageNoMoreLayout from './PageNoMoreLayout';
import { NoMoreBean } from './NoMoreBean';
import { RefreshLayoutBean } from '../refresh/RefreshLayoutBean';
import RefreshLayout from '../refresh/RefreshLayout';
import json from '@ohos.util.json';
import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG = 'PageComponent';
@Component
... ... @@ -30,7 +32,6 @@ export struct PageComponent {
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
private listScroller: Scroller = new Scroller();
needload: boolean = true;
build() {
Column() {
if (this.pageModel.viewType == ViewType.LOADING) {
... ... @@ -77,11 +78,13 @@ export struct PageComponent {
ListItem() {
Column() {
CompParser({ pageModel: this.pageModel, compDTO: compDTO, compIndex: compIndex });
}
}.onClick(()=>{
this.viewBlogInsightIntentShare(compDTO)
})
}
},
(compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp
)
(compDTO: CompDTO, compIndex: number) => JSON.stringify(compDTO))
// 加载更多
ListItem() {
... ... @@ -257,7 +260,13 @@ export struct PageComponent {
this.pageModel.pageTotalCompSize = 0;
PageHelper.getInitData(this.pageModel, this.pageAdvModel)
}, 100)
}
viewBlogInsightIntentShare(compDTO:CompDTO){
if (this.channelId === '2001' || this.channelId === '2002') {
let context = getContext(this) as common.UIAbilityContext;
viewBlogInsightIntentShare(context, this.channelId, [compDTO], ActionMode.EXECUTED)
}
}
}
... ...
import { ContentDTO , Action,GoldenPositionExtraBean} from 'wdBean';
import { ContentDTO , Action,GoldenPositionExtraBean, CompDTO} from 'wdBean';
import { CommonConstants ,ViewType} from 'wdConstant';
import PageViewModel from '../../viewmodel/PageViewModel';
import PageModel from '../../viewmodel/PageModel';
... ... @@ -128,7 +128,7 @@ struct ThemeListPage {
LazyForEach(this.pageModel.compList, (contentDTO: ContentDTO, contentIndex: number) => {
ListItem() {
Column() {
CardParser({ contentDTO });
CardParser({compDTO:new CompDTO, contentDTO });
}
}
},
... ...
import { insightIntent } from '@kit.IntentsKit';
import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean';
import { SpConstants } from 'wdConstant';
import { DisplayUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit';
... ... @@ -9,8 +8,6 @@ import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent
import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent';
import { channelSkeleton } from '../skeleton/channelSkeleton';
import { common } from '@kit.AbilityKit';
const TAG = 'TopNavigationComponent';
... ... @@ -61,8 +58,6 @@ export struct TopNavigationComponent {
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
// 传递给page的自动刷新通知
@State autoRefresh2Page: number = 0
//保存当前导航选中时的时间戳 意图开始时间
@State executedStartTime: number = new Date().getTime()
// 当前底导index
@State navIndex: number = 0
@State animationDuration: number = 0
... ... @@ -190,48 +185,6 @@ export struct TopNavigationComponent {
return item.channelType === 3
}
//意图共享
topNavInsightIntentShare(item: TopNavDTO){
let tapNavIntent: insightIntent.InsightIntent = {
intentName: 'ViewBlog',
intentVersion: '1.0.1',
identifier: '52dac3b0-6520-4974-81e5-25f0879449b5',
intentActionInfo: {
actionMode: 'EXPECTED',
currentPercentage: 50,
executedTimeSlots: {
executedEndTime: new Date().getTime(),
executedStartTime: this.executedStartTime
}
},
intentEntityInfo: {
entityName: 'Blog',
entityId: String(item.pageId) || '',
displayName: item.name,
logoURL: 'https://www-file.huawei.com/-/media/corporate/images/home/logo/huawei_logo.png',
rankingHint: 99,
isPublicData: true
}
}
console.log('yzl',JSON.stringify(tapNavIntent))
try {
let context = getContext(this) as common.UIAbilityContext;
// 共享数据
insightIntent.shareIntent(context, [tapNavIntent], (error) => {
if (error?.code) {
// 处理业务逻辑错误
console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`);
return;
}
// 执行正常业务
console.log('shareIntent succeed');
});
} catch (error) {
// 处理异常
console.error(`error.code: ${error?.code}, error.message: ${error?.message}`);
}
}
build() {
Column() {
... ...
... ... @@ -8,7 +8,8 @@ import {
AttentionBatchDTO,
CreatorDTO,
contentListParams,
InteractDataDTO
InteractDataDTO,
CompDTO
} from 'wdBean';
import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType';
import { channelSkeleton } from '../skeleton/channelSkeleton'
... ... @@ -150,7 +151,7 @@ export struct PeopleShipMainComponent {
}
ForEach(this.attentionList, (item: ContentDTO) => {
ListItem() {
CardParser({ contentDTO: item })
CardParser({compDTO:new CompDTO, contentDTO: item })
}.width("100%")
.backgroundColor(Color.Transparent)
... ...
... ... @@ -12,7 +12,8 @@ import {
InteractDataDTO,
ArticleTypeData,
ArticleListData,
PeopleShipUserDetailData
PeopleShipUserDetailData,
CompDTO
} from 'wdBean'
import { CardParser } from '../CardParser'
import { PageRepository } from '../../repository/PageRepository'
... ... @@ -79,7 +80,7 @@ export struct PeopleShipHomeArticleListComponent {
// 下拉刷新
ForEach(this.arr, (item: ContentDTO) => {
ListItem() {
CardParser({ contentDTO: item })
CardParser({compDTO:new CompDTO, contentDTO: item })
}.width("100%")
.backgroundColor(Color.Transparent)
}, (item: ContentDTO, index: number) => item.objectId + index.toString())
... ...
import { ContentDTO } from 'wdBean/Index'
import { CompDTO, ContentDTO } from 'wdBean/Index'
import { LazyDataSource, UserDataLocal } from 'wdKit/Index'
import { HttpUtils } from 'wdNetwork/Index'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
... ... @@ -96,7 +96,7 @@ export struct SearchResultComponent {
LazyForEach(this.data, (item: ContentDTO, index: number) => {
ListItem() {
Column() {
CardParser({contentDTO:item})
CardParser({compDTO:new CompDTO,contentDTO:item})
if (index != this.data.totalCount() - 1) {
Divider()
.width('100%')
... ...
import {
CompDTO,
ContentDTO,
contentListParams,
FullColumnImgUrlDTO,
... ... @@ -106,7 +107,9 @@ export struct SearchResultContentComponent {
} else {
this.bean.cnFansNum = item.fansNum + ""
}
this.bean.introduction = item.introduction
let regex:RegExp = new RegExp('\n','g')
this.bean.introduction = item.introduction.replace(regex,'')
this.bean.mainControl = item.mainControl
this.bean.banControl = item.banControl
this.bean.cnUserType = item.userType
... ... @@ -256,7 +259,7 @@ export struct SearchResultContentComponent {
if (this.searchType == "activity") {
ActivityItemComponent({ contentDTO: item })
} else {
CardParser({ contentDTO: item })
CardParser({compDTO:new CompDTO, contentDTO: item })
}
if (index != this.data.totalCount() - 1) {
Divider()
... ...
... ... @@ -14,7 +14,7 @@ const TAG: string = 'BigPicCardComponent';
// @Entry
@Component
export struct BigPicCardComponent {
@State compDTO: CompDTO = {} as CompDTO
@ObjectLink compDTO: CompDTO
contentDTO: ContentDTO = new ContentDTO();
aboutToAppear() {
... ... @@ -110,7 +110,7 @@ export struct BigPicCardComponent {
@Builder
cardBuild() {
CardParser({ contentDTO: this.contentDTO });
CardParser({ compDTO: this.compDTO, contentDTO: this.contentDTO });
}
}
... ... @@ -121,7 +121,8 @@ export struct BigPicCardComponent {
*/
@Component
export struct myBigCard_body {
private newsSrc: string = "https://k.sinaimg.cn/n/default/crawl/190/w550h440/20240118/6772-7c2385bb2741c6f88906af3514d27343.png/w700d1q75cms.jpg";
private newsSrc: string =
"https://k.sinaimg.cn/n/default/crawl/190/w550h440/20240118/6772-7c2385bb2741c6f88906af3514d27343.png/w700d1q75cms.jpg";
private newsTitle: string = "时政微观察丨新征程金融工作怎么干?“新年第一课”这样讲";
build() {
... ...
... ... @@ -58,7 +58,7 @@ export struct LikeComponent {
} else if (this.componentType == 5) {
// 图集点赞,展示标识
this.likeCompStyle5()
}else {
} else {
//1: 底部栏目样式 默认样式
this.likeCompStyle1()
}
... ... @@ -188,7 +188,7 @@ export struct LikeComponent {
.alignItems(VerticalAlign.Center)
.position({ x: '100%', })
.markAnchor({ x: '100%' })
.backgroundImage(this.likeStatus? $r('app.media.ic_like_back_Select'):$r('app.media.ic_like_back'))
.backgroundImage(this.likeStatus ? $r('app.media.ic_like_back_Select') : $r('app.media.ic_like_back'))
.backgroundImageSize(ImageSize.Auto)
.visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden)
}.width(24).height(24)
... ... @@ -209,7 +209,7 @@ export struct LikeComponent {
.width(36)
.height(36)
.borderRadius(18)
.backgroundColor(this.pageComponentType === 4 ? '#4D000000' : '#FFF5F5F5')
.backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : '#FFF5F5F5')
Row() {
... ...
import { ContentDTO } from 'wdBean';
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { CardParser } from '../CardParser';
... ... @@ -29,7 +29,7 @@ export struct RecommendList {
}
ForEach(this.recommendList, (item: ContentDTO, index: number) => {
Row() {
CardParser({ contentDTO: item });
CardParser({ compDTO:new CompDTO,contentDTO: item });
}
if (this.recommendList.length !== index + 1) {
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
... ...
... ... @@ -9,7 +9,7 @@ export struct AreaPickerDialog {
@Provide currentSecondBean: AreaListManageModel = new AreaListManageModel('','','',[])
@Provide currentThirdBean: AreaListManageModel = new AreaListManageModel('','','',[])
controller: CustomDialogController
title: string = '地区选择'
title: string = '修改地区'
@Provide dataSource: AreaListModel[] = []
result: JSON[] = [];
confirmCallback: (province:string,city:string,county:string,address:string) => void = () => {
... ... @@ -33,7 +33,7 @@ export struct AreaPickerDialog {
Blank()
Button('确定',{type:ButtonType.Normal})
Button('提交',{type:ButtonType.Normal})
.onClick(()=> {
this.controller.close()
this.confirmCallback(this.currentFirst.label,this.currentSecondBean.label,this.currentThirdBean.label,this.currentFirst.label+this.currentSecondBean.label+this.currentThirdBean.label);
... ...
... ... @@ -28,9 +28,11 @@ export struct FirstLevelComponent {
this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[index as number])
})
.backgroundColor(Color.White)
.border({color:'#e2e2e2',width:{right:0.5}})
// .border({color:'#e2e2e2',width:{right:0.5}})
.width('100%')
.layoutWeight(1)
.selectedTextStyle({color:'#666666'})
.textStyle({color:'#999999'})
}
}
.justifyContent(FlexAlign.Center)
... ...
... ... @@ -21,9 +21,11 @@ export struct SecondLevelComponent {
this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[index as number])
})
.backgroundColor(Color.White)
.border({color:'#e2e2e2',width:{right:0.5}})
// .border({color:'#e2e2e2',width:{right:0.5}})
.width('100%')
.layoutWeight(1)
.selectedTextStyle({color:'#666666'})
.textStyle({color:'#999999'})
}
}
.justifyContent(FlexAlign.Center)
... ...
... ... @@ -22,9 +22,11 @@ export struct ThirdLevelComponent {
this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[index as number])
})
.backgroundColor(Color.White)
.border({color:'#e2e2e2',width:{right:0.5}})
// .border({color:'#e2e2e2',width:{right:0.5}})
.width('100%')
.layoutWeight(1)
.selectedTextStyle({color:'#666666'})
.textStyle({color:'#999999'})
}
}
.justifyContent(FlexAlign.Center)
... ...
... ... @@ -112,13 +112,13 @@ class MinePageDatasModel{
* 包含名字和图标
*/
getMessageData():MessageItem[]{
if(this.messageData.length === 4){
if(this.messageData.length === 2){
return this.messageData
}
this.messageData.push(new MessageItem($r('app.media.msg_interact'),"互动消息","",""))
this.messageData.push(new MessageItem($r('app.media.msg_reserve'),"预约消息","",""))
this.messageData.push(new MessageItem($r('app.media.msg_history'),"历史推送","",""))
this.messageData.push(new MessageItem($r('app.media.msg_system'),"系统消息","",""))
// this.messageData.push(new MessageItem($r('app.media.msg_history'),"历史推送","",""))
// this.messageData.push(new MessageItem($r('app.media.msg_system'),"系统消息","",""))
return this.messageData
}
... ...
import { common } from '@kit.AbilityKit';
import { insightIntent } from '@kit.IntentsKit';
import { CompDTO, CompList, ContentDTO, PageInfoBean } from 'wdBean';
function generateUniqueId() {
// 生成当前时间戳
let timestamp = new Date().getTime();
// 将时间戳转换成16进制字符串
let hexString = timestamp.toString(16);
// 确保字符串长度为16位,不足的话在前面补0
while (hexString.length < 16) {
hexString = '0' + hexString;
}
// 格式化为UUID样式
let uuid = hexString.substring(0, 8) + '-' +
hexString.substring(8, 12) + '-' +
hexString.substring(12, 16) + '-' +
hexString.substring(16, 20) + '-' +
hexString.substring(20);
return uuid;
}
export const enum ActionMode {
// 将来时
EXPECTED = 'EXPECTED',
// 完成时
EXECUTED = 'EXECUTED',
}
//ViewBlog意图共享-频道列表
export function viewBlogInsightIntentShare(context: common.UIAbilityContext, entityGroupId: string,
compList: CompDTO[] | CompList[], actionMode: ActionMode) {
console.log('viewBlogInsightIntentShare',actionMode)
let insightIntentArray: insightIntent.InsightIntent [] = []
if (compList?.length > 0) {
compList?.forEach((item: CompDTO | CompList) => {
item.operDataList.forEach((_item: ContentDTO) => {
let viewBlogInsightIntentItem: insightIntent.InsightIntent = {
intentName: 'ViewBlog',
intentVersion: '1.0.1',
identifier: generateUniqueId(),
intentActionInfo: {
actionMode,
currentPercentage: 50,
//目前不考虑发生时段
// executedTimeSlots: {
// executedEndTime: new Date().getTime(),
// executedStartTime: pageModel.executedStartTime
// }
},
intentEntityInfo: {
entityName: 'Blog',
entityId: _item?.objectId,
displayName: _item?.newsTitle,
entityGroupId, //channelId
logoURL: _item?.coverUrl,
metadataModificationTime: _item?.publishTimestamp,
blogTitle: _item?.newsTitle,
blogType: 'Normal',
blogCategory: item.name,
categoryDisplayName: item.name,
blogSubTitle: _item?.newsSummary.length > 20 ?
_item?.newsSummary.substring(0, 20) : _item?.newsSummary,
blogAuthor: _item?.source,
blogPublishTime: _item?.publishTimestamp,
tag: _item?.newTags,
likeCount: _item?.interactData?.likeNum || 0,
forwardCount: _item?.interactData?.shareNum || 0,
commentCount: _item?.interactData?.commentNum || 0,
favorites: _item?.interactData?.collectNum || 0,
viewCount: _item?.interactData?.readNum || 0,
rankingHint: 99,
isPublicData: true
}
}
insightIntentArray.push(viewBlogInsightIntentItem)
})
})
console.log('yzl', JSON.stringify(insightIntentArray[0]))
try {
// 共享数据
insightIntent.shareIntent(context, insightIntentArray, (error) => {
if (error?.code) {
// 处理业务逻辑错误
console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`);
return;
}
// 执行正常业务
console.log('shareIntent succeed');
});
} catch (error) {
// 处理异常
console.error(`error.code: ${error?.code}, error.message: ${error?.message}`);
}
}
}
//ViewBlog意图共享-早晚报
export function viewColumInsightIntentShare(context: common.UIAbilityContext, entityId: string,
pageInfoBean: PageInfoBean) {
console.log('viewColumInsightIntentShare')
let viewBlogInsightIntentItem: insightIntent.InsightIntent = {
intentName: 'ViewColumn',
intentVersion: '1.0.1',
identifier: generateUniqueId(),
intentActionInfo: {
actionMode: ActionMode.EXECUTED,
currentPercentage: 50,
},
intentEntityInfo: {
entityName: 'Column',
entityId,
displayName:pageInfoBean?.topicInfo?.title,
description: pageInfoBean?.shareSummary,
logoURL:pageInfoBean?.shareCoverUrl,
activityType:['RecentViews'],
columnTitle: pageInfoBean?.topicInfo?.title,
columnSubTitle: pageInfoBean?.shareSummary,
rankingHint: 99,
isPublicData: true
}
}
try {
// 共享数据
insightIntent.shareIntent(context, [viewBlogInsightIntentItem], (error) => {
if (error?.code) {
// 处理业务逻辑错误
console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`);
return;
}
// 执行正常业务
console.log('shareIntent succeed');
});
} catch (error) {
// 处理异常
console.error(`error.code: ${error?.code}, error.message: ${error?.message}`);
}
}
... ...
... ... @@ -125,7 +125,7 @@ class EditInfoViewModel {
this.BasePostRequest(item.editDataType == WDEditDataModelType.WDEditDataModelType_nickname?HttpUrlUtils.APPOINTMENT_editUserDetail1_PATH:HttpUrlUtils.APPOINTMENT_editUserDetail_PATH,this.params)
.then((navResDTO: ResponseDTO) => {
if (navResDTO.code == 0) {
promptAction.showToast({ message: '修改成功' })
promptAction.showToast({ message: '您的资料已提交' })
success(navResDTO)
}else {
promptAction.showToast({ message: navResDTO.message })
... ...
... ... @@ -11,7 +11,8 @@ import { ArrayList } from '@kit.ArkTS';
import { WDViewDefaultType } from '../components/view/EmptyComponent';
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO';
import { viewBlogInsightIntentShare, ActionMode } from '../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG = 'PageHelper';
/**
... ... @@ -52,13 +53,13 @@ export class PageHelper {
getPageInfo(pageModel: PageModel, pageAdvModel: PageAdModel) {
pageModel.currentPage = 1;
if(pageModel.pageType == 1){
PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize,pageModel.extra).then((liveReviewDTO) => {
if(liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0){
if (pageModel.pageType == 1) {
PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize, pageModel.extra).then((liveReviewDTO) => {
if (liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0) {
pageModel.viewType = ViewType.EMPTY;
pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoContent1;
return;
}else{
} else {
//更新数据
pageModel.compList.addItems(liveReviewDTO.list);
closeRefresh(pageModel, true);
... ... @@ -66,7 +67,7 @@ export class PageHelper {
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
})
}else{
} else {
PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => {
if (pageInfo == null) {
pageModel.viewType = ViewType.EMPTY;
... ... @@ -103,7 +104,7 @@ export class PageHelper {
let index = pageInfo.groups.indexOf(group)
if (index == 0) {
// 清空comp列表
pageModel.compList.clear()
pageModel.compList.clearAllData()
}
this.getGroupData(pageModel, pageDto, index == pageInfo.groups.length - 1)
... ... @@ -119,7 +120,6 @@ export class PageHelper {
}
private async getGroupData(pageModel: PageModel, pageDto: PageDTO, isLastGroup: boolean) {
pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
if (pageDto && pageDto.compList && pageDto.compList.length > 0) {
pageModel.viewType = ViewType.LOADED;
if (isLastGroup) {
... ... @@ -135,12 +135,9 @@ export class PageHelper {
// TODO 暂时去掉互动数据,待优化。(主要是互动数据返回,如何渲染到ui上)
// TODO updateItems(sizeBefore, data),这里可能有时序问题,导致覆盖别的group数据,需要优化,考虑精准替换
// 二次请求,批查互动数据
PageViewModel.getInteractData(pageDto.compList).then((data: InteractDataDTO[]) => {
// 刷新,替换所有数据
this.resetInteract(data, pageModel.compList)
pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
pageModel.compList.reloadData()
})
this.allCompBatchRequest(pageDto.compList, pageModel)
// content级别的展现加载丢给comp自己,这里只需要处理屏蔽分页加载,pageModel.pageScroll
if (isLastGroup) {
closeRefresh(pageModel, true);
... ... @@ -276,11 +273,10 @@ export class PageHelper {
let b = advPosition - a;
// console.error('ZZZXXXXX', matInfo.advSubType + '-------------' + matInfo.advTitle + " " + advPosition + " " + a + " " + b)
if (b <= pageCompSize && b >= 0) {
let advComp: CompDTO = {
compStyle: CompStyle.Card_Comp_Adv,
matInfo: matInfo
} as CompDTO;
// 创建广告稿件
let advComp: CompDTO = new CompDTO;
advComp.compStyle = CompStyle.Card_Comp_Adv
advComp.matInfo = matInfo
if (pageCompSize == slotInfo.position) {
pageCompList.add(advComp)
... ... @@ -307,12 +303,12 @@ export class PageHelper {
*/
private compLoadMore(pageModel: PageModel) {
//聚合页
if(pageModel.pageType == 1){
PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize,pageModel.extra).then((liveReviewDTO) => {
if(liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0){
if (pageModel.pageType == 1) {
PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize, pageModel.extra).then((liveReviewDTO) => {
if (liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0) {
pageModel.hasMore = false;
return;
}else{
} else {
//更新数据
pageModel.compList.addItems(liveReviewDTO.list);
// 直接认为有分页,一直加载分页。直到没有数据,再停止
... ... @@ -323,10 +319,9 @@ export class PageHelper {
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
})
}else{
} else {
PageViewModel.getPageData(pageModel.bizCopy())
.then((data: PageDTO) => {
pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
if (data == null || data.compList == null || data.compList.length == 0) {
pageModel.hasMore = false;
} else {
... ... @@ -336,14 +331,8 @@ export class PageHelper {
//移除音频 和 活动
this.collectPageComp(pageModel, data)
// TODO 暂时屏蔽,此处代码会造成 广告逻辑错乱,只有第一页有广告数据,随着加载更多,第二页也会出现广告数据
PageViewModel.getInteractData(data.compList).then((data: InteractDataDTO[]) => {
// 刷新,替换所有数据
this.resetInteract(data, pageModel.compList)
pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
pageModel.compList.reloadData()
})
// 参与批查
this.allCompBatchRequest(data.compList, pageModel)
}
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
... ... @@ -351,6 +340,35 @@ export class PageHelper {
}
}
/**
* 信息流页面,所有稿件需要参与批查,如 批查评论、批查关注状态等接口
* @param compList
* @param pageModel
*/
private allCompBatchRequest(compList: CompDTO[], pageModel: PageModel) {
PageViewModel.getInteractData(compList).then((data: InteractDataDTO[]) => {
// 刷新,替换所有数据
this.resetInteract(data, pageModel.compList)
if(pageModel?.channelId !== '2001' && pageModel?.channelId !== '2002'){
//早晚报意图上报
let context = getContext(this) as common.UIAbilityContext;
viewBlogInsightIntentShare(context, pageModel?.channelId, compList, ActionMode.EXPECTED)
}
})
// 测试数据
// setTimeout(() => {
// let index = 1
// let comp = pageModel.compList.getData(index) as CompDTO
// comp.hasMore = 0
// //comp.operDataList[0].newsTitle = '测试111'
// let con :InteractDataDTO = new InteractDataDTO;
// con.commentNum=1000
// comp.operDataList[0].interactData = con
// Logger.debug("ZZZXXXXX",
// "-----setTimeout--------->" + comp.hasMore)
// }, 4 * 1000)
}
/**
* 移除comp
... ... @@ -359,9 +377,7 @@ export class PageHelper {
let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集页面组件、稿件和本地组件容器
let datas = pageDto.compList
for (let index = 0; index < datas.length; index++) {
const element = datas[index];
pageDto.compList.forEach((element: CompDTO) => {
let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0);
//移除音频 和 活动
if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) {
... ... @@ -372,24 +388,21 @@ export class PageHelper {
} else {
pageCompList.add(element)
}
}
}
})
// 记录
pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize
// console.error("ZZZXXXXX", " collectPageComp--->" + pageModel.pageTotalCompSize);
// 处理页面广告数据,投放到页面的位置
this.handlePageCompAdvPostion(pageCompList, pageModel, pageDto);
//遍历所有组件和稿件数据 push到页面
for (let element of pageCompList) {
pageModel.compList.push(element)
pageModel.compList.push(CompDTO.createNewsBean(element))
}
}
/**
... ... @@ -401,6 +414,7 @@ export class PageHelper {
if (interact == null || interact.length == 0) {
return
}
let time = DateTimeUtils.getTimeStamp().toString()
interact.forEach((interactData) => {
let id = interactData.contentId;
outer: for (let i = 0; i < compList.totalCount(); i++) {
... ... @@ -415,6 +429,7 @@ export class PageHelper {
}
if (id == content.objectId) {
content.interactData = interactData;
comp.timestamp = time
break outer;
}
}
... ...
... ... @@ -13,6 +13,7 @@ import {
NavigationDetailDTO,
LiveRoomDataBean
} from 'wdBean';
import { CompStyle } from 'wdConstant/Index';
import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit';
import { ResponseDTO, } from 'wdNetwork';
... ... @@ -48,14 +49,15 @@ export class PageViewModel extends BaseViewModel {
return this.getNavData();
}
async getBottomNavDetailData(id:number): Promise<NavigationDetailDTO> {
async getBottomNavDetailData(id: number): Promise<NavigationDetailDTO> {
Logger.info(TAG, `getBottomNavDetailData start`);
return this.getNavDetailData(id);
}
async getBottomNavDataMock(context: Context): Promise<NavigationBodyDTO> {
Logger.info(TAG, `getBottomNavDataMock start`);
let compRes: ResponseDTO<NavigationBodyDTO> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<NavigationBodyDTO>>(context, 'bottom_nav.json');
let compRes: ResponseDTO<NavigationBodyDTO> | null =
await ResourcesUtils.getResourcesJson<ResponseDTO<NavigationBodyDTO>>(context, 'bottom_nav.json');
if (!compRes || !compRes.data) {
Logger.info(TAG, `getBottomNavDataMock compRes bottomNavList is empty`);
return {} as NavigationBodyDTO
... ... @@ -88,7 +90,7 @@ export class PageViewModel extends BaseViewModel {
})
}
private getNavDetailData(id:number): Promise<NavigationDetailDTO> {
private getNavDetailData(id: number): Promise<NavigationDetailDTO> {
return new Promise<NavigationDetailDTO>((success, error) => {
Logger.info(TAG, `getNavData start`);
PageRepository.fetchNavigationDetailDataApi(id).then((navResDTO: ResponseDTO<NavigationDetailDTO>) => {
... ... @@ -122,7 +124,8 @@ export class PageViewModel extends BaseViewModel {
// 加载更多,返回无数据
return {} as PageDTO
}
let compRes: ResponseDTO<PageDTO> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context, 'comp_list0.json');
let compRes: ResponseDTO<PageDTO> | null =
await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context, 'comp_list0.json');
if (!compRes || !compRes.data) {
Logger.info(TAG, `getCompList compRes is empty`);
return {} as PageDTO
... ... @@ -164,7 +167,8 @@ export class PageViewModel extends BaseViewModel {
}
private async getPageData2(context: Context): Promise<PageDTO> {
let compRes: ResponseDTO<PageDTO> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context, 'comp_list2.json');
let compRes: ResponseDTO<PageDTO> | null =
await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context, 'comp_list2.json');
if (!compRes || !compRes.data) {
Logger.info(TAG, `getCompList compRes is empty`);
return {} as PageDTO
... ... @@ -339,7 +343,15 @@ export class PageViewModel extends BaseViewModel {
param.contentList = new Array<ContentBean>();
compList.forEach((value) => {
let contentList = value.operDataList;
if (contentList != null && contentList.length > 0) {
let letBatch = false
// 只有稿件才能批查
if (!Number.isNaN(Number(value.compStyle))) {
letBatch = true
}
if (letBatch) {
if (contentList != null && contentList.length == 1) { // 对只有一条数据的稿件参与批查
contentList.forEach((v) => {
if (StringUtils.isNotEmpty(v.objectId)) {
let bean = {} as ContentBean;
... ... @@ -349,6 +361,7 @@ export class PageViewModel extends BaseViewModel {
}
})
}
}
})
return param;
}
... ... @@ -414,7 +427,7 @@ export class PageViewModel extends BaseViewModel {
})
}
async postThemeList(pageNum: number, pageSize: number,extra: string) : Promise<LiveReviewDTO> {
async postThemeList(pageNum: number, pageSize: number, extra: string): Promise<LiveReviewDTO> {
let bean: GoldenPositionExtraBean = JSON.parse(extra)
bean.pageNum = pageNum
bean.pageSize = pageSize
... ...
... ... @@ -64,13 +64,13 @@ export struct DetailPlayLiveCommon {
// if (this.contentDetailData.openComment === 1) {
console.log(TAG, '查询视频详情用于评论展示 openComment:', this.contentDetailData.openComment)
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
this.publishCommentModel.commentContent = ''
// }
}
... ...
... ... @@ -166,12 +166,13 @@ export struct DetailPlayShortVideoPage {
this.queryNewsInfoOfUser()
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
this.publishCommentModel.commentContent = ''
}
... ... @@ -198,6 +199,7 @@ export struct DetailPlayShortVideoPage {
})
}
.width('100%')
.layoutWeight(1)
.onClick(() => {
this.playerController?.switchPlayOrPause();
... ... @@ -222,9 +224,10 @@ export struct DetailPlayShortVideoPage {
}
.height('100%')
.width('100%')
.padding({
top: this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL ? 0 : this.topSafeHeight + 'px'
})
// .padding({
// top: this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL ? 0 : this.topSafeHeight + 'px'
// })
if (this.showCommentList) {
CommentComponentPage({})
... ...
... ... @@ -258,15 +258,12 @@ export struct VideoChannelDetail {
.visibility(this.isMouted ? Visibility.None : Visibility.Visible)
Swiper(this.swiperController) {
ForEach(this.data, (item: ContentDetailDTO, index: number) => {
Column() {
DetailPlayShortVideoPage({
contentDetailData: item,
currentIndex: this.currentIndex,
index: index,
interactData: this.interactDataList[index]
})
}.width('100%')
.height('100%')
}, (item: ContentDetailDTO) => item.newsId + '')
}
.displayCount(1, true)
... ...
... ... @@ -17,13 +17,13 @@ export struct CommentComponentPage {
aboutToAppear(): void {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType || '')
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId || '')
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle || '')
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '')
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '')
}
build() {
... ...
import { WDRouterPage } from 'wdRouter/src/main/ets/router/WDRouterPage'
import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule'
import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index'
@CustomDialog
export struct CustomProtocolDialog {
controller: CustomDialogController
cancel: () => void = () => {
}
confirm: () => void = () => {
}
build() {
Column() {
Text("温馨提示")
.fontColor("#222222")
.fontSize(18)
.width("100%")
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Center)
.margin({ top: 20 })
Text() {
Span("为保障您的合法权益,请阅读并同意").fontSize(14).fontColor("#666666")
Span("《用户协议》").fontSize(14).fontColor("#ED2800").onClick(()=>{
let bean={contentID:"1",pageID:""} as Params
WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean)
this.controller.close()
})
Span("及").fontSize(14).fontColor("#666666")
Span("《隐私政策》").fontSize(14).fontColor("#ED2800").onClick(()=>{
let bean={contentID:"2",pageID:""} as Params
WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean)
this.controller.close()
})
Span("后进行登录").fontSize(14).fontColor("#666666")
}.margin({ top: 12, left: 16, right: 16 })
Divider().color("#999999").width("100%").margin({ top: 14 }).height('1vp')
Row() {
Text('放弃登录')
.fontSize(16)
.fontColor("#999999")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Center)
.onClick(() => {
this.controller.close()
if (this.cancel) {
this.cancel()
}
})
.height('100%')
// Divider().color("#999999").height('100%').width('0.5vp')
Text('同意并登录')
.fontSize(16)
.fontColor("#ED2800")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Center)
.border({
width: { left: 1 },
color: "#999999",
style: { left: BorderStyle.Solid }
})
.onClick(() => {
this.controller.close()
if (this.confirm) {
this.confirm()
}
})
.height('100%')
}.layoutWeight(1).justifyContent(FlexAlign.Center)
}.height(161).backgroundColor(Color.White).borderRadius(6).width('74%')
}
}
\ No newline at end of file
import { Logger, EmitterEventId, EmitterUtils, DateTimeUtils,CustomToast, StringUtils, NetworkUtil } from 'wdKit'
import { CustomProtocolDialog } from './CustomProtocolDialog'
import router from '@ohos.router'
import { LoginViewModel } from './LoginViewModel'
import { LoginInputComponent } from './LoginInputComponent'
... ... @@ -57,18 +56,6 @@ struct LoginPage {
maskColor:"#00000000"
})
dialogController: CustomDialogController = new CustomDialogController({
builder: CustomProtocolDialog({
cancel: () => {
},
confirm: () => {
this.requestLogin()
}
}),
customStyle: true,
alignment:DialogAlignment.Center
})
loginViewModel = new LoginViewModel()
@State isProtocol:boolean=false
onCodeSend() {
... ... @@ -467,32 +454,58 @@ struct ProtocolComponent {
Column() {
Text("温馨提示")
.fontColor("#222222")
.fontSize(18)
.fontSize("35lpx")
.lineHeight("50lpx")
.width("100%")
.fontWeight(FontWeight.Bold)
.fontWeight(500)
.textAlign(TextAlign.Center)
.margin({ top: 20 })
.margin({ top: "38lpx" })
Text() {
Span("为保障您的合法权益,请阅读并同意").fontSize(14).fontColor("#666666")
Span("《用户协议》").fontSize(14).fontColor("#ED2800").onClick(() => {
Span("为保障您的合法权益,请阅读并同意")
.fontSize("27lpx")
.lineHeight("42lpx")
.fontWeight(400)
.fontColor("#666666")
Span("《用户协议》")
.fontSize("27lpx")
.lineHeight("42lpx")
.fontWeight(400)
.fontColor("#ED2800")
.onClick(() => {
let bean = { contentID: "1", pageID: "" } as Params
WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean)
})
Span("及").fontSize(14).fontColor("#666666")
Span("《隐私政策》").fontSize(14).fontColor("#ED2800").onClick(() => {
Span("及").fontSize("27lpx")
.lineHeight("42lpx")
.fontWeight(400)
.fontColor("#666666")
Span("《隐私政策》")
.fontSize("27lpx")
.lineHeight("42lpx")
.fontWeight(400)
.fontColor("#ED2800")
.onClick(() => {
let bean = { contentID: "2", pageID: "" } as Params
WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean)
})
Span("后进行登录").fontSize(14).fontColor("#666666")
}.margin({ top: 12, left: 16, right: 16 })
Divider().color("#999999").width("100%").margin({ top: 14 }).height('1vp')
Span("后进行登录")
.fontSize("27lpx")
.lineHeight("42lpx")
.fontWeight(400)
.fontColor("#666666")
}.margin({ top: "23lpx", left: "31lpx", right: "31lpx" })
.wordBreak(WordBreak.BREAK_ALL)
.textAlign(TextAlign.Start)
Divider().color("#f5f5f5").width("100%").margin({ top: "27lpx" }).height('1lpx').strokeWidth('1lpx')
Row() {
Text('放弃登录')
.fontSize(16)
.fontSize("31lpx")
.fontWeight(500)
.lineHeight("42lpx")
.fontColor("#999999")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Center)
.onClick(() => {
if (this.cancelMethod) {
... ... @@ -500,18 +513,26 @@ struct ProtocolComponent {
}
})
.height('100%')
// Divider().color("#999999").height('100%').width('0.5vp')
Divider()
.width("1lpx")
.strokeWidth('1lpx')
.vertical(true)
.height('100%')
.color("#F5F5F5")
Text('同意并登录')
.fontSize(16)
.fontSize("31lpx")
.fontWeight(500)
.lineHeight("42lpx")
.fontColor("#ED2800")
.layoutWeight(1)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Center)
.border({
width: { left: 1 },
color: "#999999",
color: "#F5F5F5",
style: { left: BorderStyle.Solid }
})
.onClick(() => {
if (this.agreeMethod) {
... ... @@ -519,8 +540,13 @@ struct ProtocolComponent {
}
})
.height('100%')
}.layoutWeight(1).justifyContent(FlexAlign.Center)
}.height(161).backgroundColor(Color.White).borderRadius(6).width('74%')
}.layoutWeight(1)
.justifyContent(FlexAlign.Center)
}
.backgroundColor(Color.White)
.borderRadius("12lpx")
.width("528lpx")
.height("309lpx")
}.width('100%')
.height('100%')
... ...
import AbilityConstant from '@ohos.app.ability.AbilityConstant';
import app from '@system.app';
import hilog from '@ohos.hilog';
import UIAbility from '@ohos.app.ability.UIAbility';
import Want from '@ohos.app.ability.Want';
import window from '@ohos.window';
import { BusinessError } from '@ohos.base';
import { EmitterEventId, EmitterUtils, WindowModel } from 'wdKit';
import { DeviceUtil, EmitterEventId, EmitterUtils, WindowModel } from 'wdKit';
import { ConfigurationConstant } from '@kit.AbilityKit';
import { WDPushNotificationManager } from 'wdHwAbility/Index';
import { StartupManager } from '../startupmanager/StartupManager';
... ... @@ -18,6 +19,11 @@ export default class EntryAbility extends UIAbility {
// 还没深色模式需求,暂直接不跟随系统。
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT);
app.setImageRawDataCacheSize(100) // 100 设置内存中缓存解码后图片的数量上限,单位为 number。
app.setImageCacheCount(100 * 1024 * 1024) // 设置解码前图片数据内存缓存上限为100MB。设置内存中缓存解码前图片数据的大小上限,单位为字节。
app.setImageFileCacheSize(100 * 1024 * 1024) // 设置图片文件缓存的大小上限,单位为字节
}
// App活着情况下,点击推送通知进入
... ... @@ -52,8 +58,20 @@ export default class EntryAbility extends UIAbility {
console.info('floatWindowClass audioWidth' + audioWidth);
// let a = new WindowModel();
// 设置窗口的显示方向属性
// 在普通phone/折叠屏/tablet设备上以沉浸式(全屏)启动
if (DeviceUtil.isPhone() || DeviceUtil.isTablet()) {
// 设置窗口的布局是否为沉浸式布局
// 沉浸式布局是指布局不避让状态栏与导航栏,组件可能产生与其重叠的情况。
// 非沉浸式布局是指布局避让状态栏与导航栏,组件不会与其重叠。
// windowClass.setWindowLayoutFullScreen(true)
// 设置窗口全屏模式时窗口内导航栏、状态栏的属性
// windowClass.setWindowSystemBarProperties({
// statusBarContentColor: "#FFFFFF"
// })
// 设置启动时窗口的显示方向属性,
// 普通phone以PORTRAIT/竖屏显示模式启动
// 折叠屏和tablet是以AUTO_ROTATION_RESTRICTED/受开关控制的自动旋转模式启动
WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT)
.then(() => {
hilog.info(0x0000, 'testTag', 'setPreferredOrientation Succeeded');
... ... @@ -62,6 +80,8 @@ export default class EntryAbility extends UIAbility {
hilog.error(0x0000, 'testTag',
`setPreferredOrientation catch, error error.name : ${err.name}, error.message:${err.message}`);
})
}
//../../../../../../features/wdLogin/src/main/ets/pages/launchPage/LaunchPage
windowStage.loadContent('pages/launchPage/LaunchPage', (err, data) => {
if (err.code) {
... ...
... ... @@ -47,7 +47,7 @@ struct LaunchInterestsHobbiesPage {
.width('100%')
.height('61lpx')
.margin({top:'84lpx'})
Text('完善信息将为您推荐个性化的内容')
Text('完善信息,将为您推荐个性化的内容')
.fontSize('27lpx')
.textAlign(TextAlign.Center)
.fontColor('#9E9E9E')
... ... @@ -69,8 +69,8 @@ struct LaunchInterestsHobbiesPage {
Image('')
.width('100%')
.height('100%')
.backgroundColor(Color.Gray)
.opacity(item.choose?0.85:0)
.backgroundColor(Color.Black)
.opacity(item.choose?0.5:0)
.borderRadius(5)
}
... ... @@ -134,14 +134,14 @@ struct LaunchInterestsHobbiesPage {
.width('662lpx')
.height('84lpx')
.backgroundColor(Color.White)
.opacity(this.selectCount == 0 ? 0.3 : 0)
.opacity(this.selectCount == 0 ? 0.6 : 0)
.borderRadius('10lpx')
.onClick(()=>{
if (this.selectCount == 0) {
promptAction.showToast({
message : '请先选择您感兴趣的内容哦',
duration: 2000,
bottom: '50%'
bottom: '50%',
})
return
}
... ...