张善主

Merge remote-tracking branch 'origin/main'

# Conflicts:
#	sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
#	sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card19Component.ets
Showing 87 changed files with 2018 additions and 539 deletions

Too many changes to show.

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

... ... @@ -20,6 +20,8 @@ export { WindowModel } from './src/main/ets/utils/WindowModel'
export { SPHelper } from './src/main/ets/utils/SPHelper'
export { KVStoreHelper } from './src/main/ets/utils/KVStoreHelper'
export { AccountManagerUtils } from './src/main/ets/utils/AccountManagerUtils'
export { CollectionUtils } from './src/main/ets/utils/CollectionUtils'
... ...
... ... @@ -4,7 +4,7 @@ import tingyun, { LogLevel } from '@tingyun/harmonyos';
export class TingyunAPM {
private static TINGYUN_APP_KEY = "" //TODO:
private static TINGYUN_APP_KEY = "ebe0ed7f09f54af681201b784858dde2"
private static TINGYUN_REDIRECT_HOST = "wkrt.tingyun.com"
private static logEnable() {
... ...
... ... @@ -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';
}
}
... ...
... ... @@ -34,6 +34,14 @@ export enum EmitterEventId {
// App进入后台
APP_ENTER_BACKGROUD = 101,
// 更换音频名称
AUDIO_CHANGE_TITLe = 10,
// 更换音频状态
AUDIO_CHANGE_STATUS = 11,
// 获取音频悬浮窗焦点状态
AUDIO_WINDOW_TYPE = 12,
}
... ...
... ... @@ -23,7 +23,7 @@ export class EmitterUtils {
* @param eventId 事件id
* @param str 字符串数据
*/
static sendEvent(eventId: number, str?: string) {
static sendEvent(eventId: number, str?: string | number) {
let event: emitter.InnerEvent = {
eventId: eventId,
priority: emitter.EventPriority.LOW
... ...
import { distributedKVStore } from '@kit.ArkData';
import { BusinessError } from '@kit.BasicServicesKit';
import { AppUtils } from './AppUtils';
import { Logger } from './Logger';
const TAG = 'KVStoreHelper'
/**
* 键值型数据库管理类,类似sp,存储变大,单条数据,value<4M
*/
export class KVStoreHelper {
private static _context: Context;
// TODO 待优化,可以指定数据库名,创建多个数据库。当前没有需求,只创建一个,缓存接口数据用。
private static _default_store_id: string = 'default_kv_store';
private kvManager: distributedKVStore.KVManager | undefined = undefined;
private kvStore: distributedKVStore.SingleKVStore | undefined = undefined;
private constructor() {
Logger.error(TAG, 'constructor')
}
static init(context: Context) {
Logger.error(TAG, 'init')
KVStoreHelper._context = context;
KVStoreHelper.default.createKVManager()
KVStoreHelper.default.createKVStore()
}
// 静态属性
static default: KVStoreHelper = new KVStoreHelper();
private createKVManager() {
if (this.kvManager) {
return
}
if (!KVStoreHelper._context) {
Logger.fatal(TAG, 'context is null, must be initialized first')
return
}
let context: Context = KVStoreHelper._context;
const kvManagerConfig: distributedKVStore.KVManagerConfig = {
context: context,
bundleName: AppUtils.getPackageName(context)
};
try {
// 创建KVManager实例
this.kvManager = distributedKVStore.createKVManager(kvManagerConfig);
Logger.info(TAG, 'Succeeded in creating KVManager.');
// 继续创建获取数据库
} catch (e) {
let error = e as BusinessError;
Logger.error(TAG, `Failed to create KVManager. Code:${error.code},message:${error.message}`);
}
}
private createKVStore() {
if (this.kvStore) {
return
}
if (!this.kvManager) {
this.createKVManager()
// 直接拦截,避免陷入循环
Logger.error(TAG, 'kvManager is null, please re-create it and try again')
return
}
try {
const options: distributedKVStore.Options = {
createIfMissing: true,
encrypt: false,
backup: false,
autoSync: false,
// kvStoreType不填时,默认创建多设备协同数据库
kvStoreType: distributedKVStore.KVStoreType.SINGLE_VERSION,
securityLevel: distributedKVStore.SecurityLevel.S1
};
this.kvManager?.getKVStore<distributedKVStore.SingleKVStore>(KVStoreHelper._default_store_id, options,
(err, store: distributedKVStore.SingleKVStore) => {
if (err) {
Logger.error(TAG, `Failed to get KVStore: Code:${err.code},message:${err.message}`);
return;
}
Logger.info(TAG, 'Succeeded in getting KVStore.');
this.kvStore = store;
// 请确保获取到键值数据库实例后,再进行相关数据操作
});
} catch (e) {
let error = e as BusinessError;
Logger.error(TAG, `An unexpected error occurred. Code:${error.code},message:${error.message}`);
}
}
private checkStoreCreated() {
if (!this.kvManager) {
this.createKVManager()
}
if (!this.kvStore) {
this.createKVStore()
}
}
get(key: string, def: boolean | string | number | Uint8Array): Promise<boolean | string | number | Uint8Array> {
// this.checkStoreCreated()
return new Promise<boolean | string | number | Uint8Array>((success, failed) => {
try {
this.kvStore?.get(key, (err, data) => {
if (err != undefined) {
Logger.debug(TAG, `Failed to get data. Code:${err.code},message:${err.message}`);
success(def)
return;
}
success(data)
Logger.debug(TAG, `Succeeded in getting data. Data:${data}`);
});
} catch (e) {
success(def)
let error = e as BusinessError;
Logger.error(TAG, `Failed to get data. Code:${error.code},message:${error.message}`);
}
});
}
put(key: string, value: boolean | string | number | Uint8Array) {
// this.checkStoreCreated()
try {
this.kvStore?.put(key, value, (err) => {
if (err !== undefined) {
Logger.debug(TAG, `Failed to put data. Code:${err.code},message:${err.message}`);
return;
}
Logger.debug(TAG, 'Succeeded in putting data.');
});
} catch (e) {
let error = e as BusinessError;
Logger.error(TAG, `An unexpected error occurred. Code:${error.code},message:${error.message}`);
}
}
del(key: string) {
// this.checkStoreCreated()
try {
this.kvStore?.delete(key, (err) => {
if (err !== undefined) {
Logger.debug(TAG, `Failed to delete data. Code:${err.code},message:${err.message}`);
return;
}
Logger.debug(TAG, 'Succeeded in deleting data.');
});
} catch (e) {
let error = e as BusinessError;
Logger.error(TAG, `An unexpected error occurred. Code:${error.code},message:${error.message}`);
}
}
}
\ No newline at end of file
... ...
... ... @@ -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
... ...
... ... @@ -4,7 +4,7 @@ import { Logger } from './Logger';
const TAG = 'SPHelper'
/**
* sp存储
* sp存储,单条数据,value<1k;业务数据超过1k的,建议使用KVStoreHelper
*/
export class SPHelper {
private static context: Context;
... ...
... ... @@ -5,7 +5,7 @@ export class ToastUtils {
private static shortToastTime: number = 1000
static showToast(message: ResourceStr, duration: number) {
prompt.showToast({ message: message, duration: duration })
prompt.showToast({ message: message, duration: duration, alignment: Alignment.Center })
}
static shortToast(message: ResourceStr) {
... ...
... ... @@ -12,3 +12,5 @@ export { HttpUtils } from "./src/main/ets/utils/HttpUtils"
export { HostEnum, HostManager } from "./src/main/ets/http/HttpHostManager"
export { CacheData } from "./src/main/ets/utils/CacheData"
... ...
... ... @@ -330,6 +330,26 @@ export class HttpUrlUtils {
static readonly MESSAGE_UN_READ_DATA_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/polymerizationInfo?createTime=";
/**
* 直播详情-直播人数
*/
static readonly LIVE_ROOM_BATCH_ALL_DATA_PATH: string = "/api/live-center-message/zh/a/live/room/number/batch/all";
/**
* 点击消息
*/
static readonly SEND_MESSAGE_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/touch?createTime=";
/**
* 点击具体某个消息
*/
static readonly ENTER_MESSAGE_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/readAll?contentType=";
/**
* 推送消息
*/
static readonly HISTORY_PUSH_MESSAGE_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/push";
/**
* 意见反馈-提交
*/
static readonly FEEDBACK_COMMIT_PATH: string = "/api/rmrb-interact/interact/zh/c/user/feedBack";
... ... @@ -444,7 +464,7 @@ export class HttpUrlUtils {
/*游客发布评论*/
static getNoUserPublishCommentUrl() {
let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/commentLike"
let url = HttpUrlUtils.getHost() + "/api/rmrb-comment/comment/zh/c/visitorPublish"
return url
}
... ... @@ -751,4 +771,29 @@ export class HttpUrlUtils {
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/common/user/c/device/push";
return url;
}
//获取直播人数
static getLiveRoomBatchAllDataUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_ROOM_BATCH_ALL_DATA_PATH
return url
}
//点击消息
static getSendClickMessageUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEND_MESSAGE_PATH
return url
}
//消息 历史推送消息
static getHistoryPushUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.HISTORY_PUSH_MESSAGE_PATH
return url
}
//点击具体某个消息
static getEnterClickMessageUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.ENTER_MESSAGE_PATH
return url
}
}
... ...
/**
* 接口数据存储封装类
*/
import { DateTimeUtils, StringUtils } from 'wdKit/Index';
import { CacheDataSaveUtil } from './CacheDataSaveUtil';
export class CacheData {
// 接口返回数据
networkData?: object;
// 数据更新时间戳
updateTimeInMillis: number = 0;
// 接口返回md5,用于判断接口数据是否更新
md5: string = '';
constructor(md5: string, timeMillis: number, networkData: object) {
this.md5 = md5
this.updateTimeInMillis = timeMillis
this.networkData = networkData
}
/**
* 根据新旧md5值进行判断,是否需要刷新数据
* @param responseMd5 新值,接口返回
* @returns
*/
needRefreshByMd5(responseMd5: string): boolean {
if (StringUtils.isEmpty(this.md5) || StringUtils.isEmpty(responseMd5)) {
return false
}
return this.md5 != responseMd5
}
static saveCacheData(cacheKey: string, data: object, responseMd5: string) {
if (!data) {
return
}
let time = DateTimeUtils.getTimeStamp()
let cacheData = new CacheData(responseMd5, time, data)
CacheDataSaveUtil.save(cacheKey, JSON.stringify(cacheData))
}
/**
* 获取缓存数据
*/
static getLocalCacheData(key: string): Promise<CacheData | null> {
return new Promise<CacheData | null>((success) => {
if (StringUtils.isEmpty(key)) {
success(null)
return
}
let ll = CacheDataSaveUtil.get(key)
if (ll instanceof Promise) {
ll.then((data) => {
let str = data as string
let cache = JSON.parse(str) as CacheData
success(cache)
})
} else {
success(null)
}
})
}
}
\ No newline at end of file
... ...
import { KVStoreHelper, StringUtils } from 'wdKit/Index';
/**
* 接口数据存储工具类
*/
export class CacheDataSaveUtil {
static save(key: string, value: string) {
if (StringUtils.isEmpty(key)) {
return
}
KVStoreHelper.default.put(key, value)
}
static get(key: string) {
if (StringUtils.isEmpty(key)) {
return ''
}
return KVStoreHelper.default.get(key, '')
}
}
\ No newline at end of file
... ...
... ... @@ -119,6 +119,8 @@ export class WDRouterPage {
static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage");
//消息主页
static mineMessagePage = new WDRouterPage("wdComponent", "ets/pages/MineMessagePage");
//预约消息主页
static subscribeMessagePage = new WDRouterPage("wdComponent", "ets/pages/SubscribeMessagePage");
//搜索人民号主页
static searchCreatorPage = new WDRouterPage("wdComponent", "ets/pages/SearchCreatorPage");
//人民号主页
... ...
... ... @@ -20,14 +20,15 @@ export class HomeChannelUtils {
* @param channelId 频道id【顶导id】
* @param pageId 目标页面id
*/
jumpChannelTab(channelId: string, pageId: string) {
jumpChannelTab(channelId: string, pageId: string, pageName?: string) {
// 1、首页所有展示频道遍历,找到目标频道
// 2、频道管理里的,非我的频道所有列表遍历,找到目标频道 【这步去掉,和this.bottomNavData重复了】
// 3、一级频道【1、2里找到目标】->【切换底导、切换频道/新增临时频道】
// 4、二级频道【1、2里都没有找到目标】->【跳转栏目页面-ColumnPageComponent】
// 1. 遍历查找目标channel
if (this.bottomNavData == null || this.bottomNavData.bottomNavList == null || this.bottomNavData.bottomNavList.length <= 0) {
if (this.bottomNavData == null || this.bottomNavData.bottomNavList == null ||
this.bottomNavData.bottomNavList.length <= 0) {
this.jumpColumn(channelId, pageId)
return
}
... ... @@ -51,16 +52,17 @@ export class HomeChannelUtils {
}
}
if (StringUtils.isEmpty(bean.bottomNavId)) {
this.jumpColumn(channelId, pageId)
this.jumpColumn(channelId, pageId, pageName)
} else {
this.jumpHomeChannel(bean)
}
}
jumpColumn(channelId: string, pageId: string) {
jumpColumn(channelId: string, pageId: string, pageName?: string) {
let params: AssignChannelParam = new AssignChannelParam()
params.pageId = pageId
params.channelId = channelId
params.pageName = pageName || ''
WDRouterRule.jumpWithPage(WDRouterPage.columnPage, params)
}
... ... @@ -77,6 +79,8 @@ export class AssignChannelParam {
pageId: string = '';
channelId: string = '';
bottomNavId: string = '';
// 跳转专题/二级栏目用到
pageName: string = ''
}
let homeChannelUtils = new HomeChannelUtils();
... ...
... ... @@ -108,9 +108,9 @@ export class ProcessUtils {
break;
case ContentConstants.TYPE_TELETEXT:
// 图文详情,跳转h5
if(content?.linkUrl){ //有 linkUrl 走专题页展示逻辑
ProcessUtils.gotoSpecialTopic(content)
}else{
if (content?.linkUrl) { //有 linkUrl 走专题页展示逻辑
ProcessUtils.gotoSpecialTopic(content,true)
} else {
ProcessUtils.gotoWeb(content);
}
break;
... ... @@ -191,13 +191,14 @@ export class ProcessUtils {
WDRouterRule.jumpWithAction(taskAction)
}
public static gotoSpecialTopic(content: ContentDTO) {
public static gotoSpecialTopic(content: ContentDTO, backVisibility?: boolean) {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
contentID: content?.objectId,
url: content.linkUrl,
pageID: 'SPACIAL_TOPIC_PAGE',
backVisibility: backVisibility,
extra: {
relType: content?.relType,
relId: content?.relId,
... ... @@ -219,6 +220,9 @@ export class ProcessUtils {
}
public static gotoDefaultWeb(content: ContentDTO) {
// 内链
if(content.openType == '1'){
let taskAction: Action = {
type: 'JUMP_H5_BY_WEB_VIEW',
params: {
... ... @@ -226,7 +230,16 @@ export class ProcessUtils {
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoWeb, ${content.objectId}`);
}else if(content.openType == '2') {
// 外链
ProcessUtils.jumpExternalWebPage(content.linkUrl);
}else {
// 无需跳转
}
Logger.debug(TAG, `gotoWeb, ${content.objectId}`)
}
static commentGotoWeb(content: commentInfo) {
... ... @@ -433,8 +446,8 @@ export class ProcessUtils {
*
* @param channelId 频道id【顶导id】
*/
public static jumpChannelTab(channelId: string, pageId: string) {
HomeChannelUtils.jumpChannelTab(channelId, pageId)
public static jumpChannelTab(channelId: string, pageId: string, pageName?: string) {
HomeChannelUtils.jumpChannelTab(channelId, pageId, pageName)
}
/**
... ...
... ... @@ -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',
... ...
... ... @@ -12,26 +12,14 @@ const TAG = 'WdWebComponent';
@Component
export struct WdWebComponent {
webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
onWebPrepared: () => void = () => {}
@Prop backVisibility: boolean = false
onWebPrepared: () => void = () => {
}
@Prop webUrl: string = ''
@Prop @Watch('onReloadStateChanged') reload: number = 0
@Link isPageEnd: boolean
build() {
Column() {
Row() {
Image($r("app.media.ic_back"))
.width(44)
.padding(13)
.aspectRatio(1)
.onClick(() => {
router.back();
})
}.backgroundColor(Color.Black)
.width('100%')
.height(44)
.visibility(this.backVisibility ? Visibility.Visible : Visibility.None)
Web({ src: this.webUrl, controller: this.webviewControl })
.domStorageAccess(true)
.databaseAccess(true)
... ... @@ -76,6 +64,7 @@ export struct WdWebComponent {
this.webviewControl.registerHandler(handleName, { handle: handle });
}
}
/**
* 默认【CallNative】逻辑处理
*/
... ... @@ -99,5 +88,11 @@ export struct WdWebComponent {
Logger.debug(TAG, 'onLoadIntercept return false');
return false
}
onReloadStateChanged() {
Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`);
if (this.reload > 0) {
this.webviewControl.refresh()
}
}
}
... ...
... ... @@ -5,14 +5,17 @@ import { performJSCallNative } from './JsBridgeBiz';
import { H5CallNativeType } from './H5CallNativeType';
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
import { DateTimeUtils } from 'wdKit'
const TAG = 'WdWebLocalComponent';
@Component
export struct WdWebLocalComponent {
webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
onWebPrepared: () => void = () => {}
onWebPrepared: () => void = () => {
}
@Prop backVisibility: boolean = false
@Prop webResource: Resource = {} as Resource
@Prop @Watch('onReloadStateChanged') reload: number = 0
@State webHeight: string | number = '100%'
@Link isPageEnd: boolean
@State videoUrl: string = ''
... ... @@ -47,15 +50,14 @@ export struct WdWebLocalComponent {
Row() {
RelativeContainer() {
// Web({ src: this.webResource, controller: this.webviewControl, renderMode: RenderMode.SYNC_RENDER })
Web({ src: this.webResource, controller: this.webviewControl})
Web({ src: this.webResource, controller: this.webviewControl })
.domStorageAccess(true)
.databaseAccess(true)
.javaScriptAccess(true)
.imageAccess(true)
.mixedMode(MixedMode.All)
.onlineImageAccess(true)
.enableNativeEmbedMode(true)
// .layoutMode(WebLayoutMode.FIT_CONTENT)
.enableNativeEmbedMode(true)// .layoutMode(WebLayoutMode.FIT_CONTENT)
// .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST })
.height(this.webHeight)
.onPageBegin((event) => {
... ... @@ -113,18 +115,21 @@ export struct WdWebLocalComponent {
}
})
Row() {
Image($r(this.isPause ? 'app.media.icon_play' : 'app.media.icon_pause'))
Image(this.isPause ? $r('app.media.icon_play') : $r('app.media.icon_pause'))
.width(24)
.height(24)
.onClick(()=>{
if(this.isPause){
.onClick(() => {
if (this.isPause) {
this.controller.start()
}else{
} else {
this.controller.pause()
}
})
Row() {
Text(DateTimeUtils.getFormattedDuration(this.currentTime * 1000)).fontSize(12).fontColor(Color.White).fontWeight(600)
Text(DateTimeUtils.getFormattedDuration(this.currentTime * 1000))
.fontSize(12)
.fontColor(Color.White)
.fontWeight(600)
Slider({
value: this.currentTime,
min: 0,
... ... @@ -132,8 +137,7 @@ export struct WdWebLocalComponent {
})
.width("50%")
.selectedColor('#ED2800')
.margin({ left: 4, right: 4 })
// .blockStyle({
.margin({ left: 4, right: 4 })// .blockStyle({
// type: SliderBlockType.IMAGE,
// image: $r('app.media.slider_block')
// })
... ... @@ -141,14 +145,17 @@ export struct WdWebLocalComponent {
.onChange((value: number, mode: SliderChangeMode) => {
this.controller.setCurrentTime(value);
})
Text(DateTimeUtils.getFormattedDuration(this.durationTime * 1000)).fontSize(12).fontColor(Color.White).fontWeight(600)
Text(DateTimeUtils.getFormattedDuration(this.durationTime * 1000))
.fontSize(12)
.fontColor(Color.White)
.fontWeight(600)
}
.justifyContent(FlexAlign.Center)
Image($r('app.media.icon_full_screen'))
.width(24)
.height(24)
.onClick(()=>{
.onClick(() => {
this.controller.requestFullscreen(true)
})
}
... ... @@ -234,5 +241,11 @@ export struct WdWebLocalComponent {
Logger.debug(TAG, 'onLoadIntercept return false');
return false
}
onReloadStateChanged() {
Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`);
if (this.reload > 0) {
this.webviewControl.refresh()
}
}
}
... ...
... ... @@ -10,73 +10,77 @@
/*
信息流广告素材解析累
*/
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 = ''
// 本地字段
originalPostion : number = -1 // 广告原始投放位置
}
/**
* 信息流广告位
*/
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
... ...
... ... @@ -10,6 +10,7 @@ import { BaseDTO } from '../component/BaseDTO';
@Observed
export class ContentDTO implements BaseDTO {
shareFlag?:string='1';
appStyle: string = '';
cityCode: string = '';
coverSize: string = '';
... ... @@ -61,6 +62,7 @@ export class ContentDTO implements BaseDTO {
videoInfo: VideoInfoDTO = {} as VideoInfoDTO; // 视频新闻信息【BFF聚合】,视频非原片+清晰度最高的
newsSummary: string = ''; //appstyle:2 ,新闻详情
contentText?: string ='';
// 二次请求接口,返回的数据,这里组装到content里;
interactData?: InteractDataDTO;
... ...
/**
* 批查接口查询互动相关数据,返回数据bean
*/
@Observed
export class InteractDataDTO {
collectNum: number | string = 0;
commentNum: number | string = 0;
... ...
... ... @@ -25,4 +25,5 @@ export interface Params {
creatorId?: string; //号主id
videoUrl?: string;
videoCoverUrl?: string;
backVisibility?: boolean; //展示顶部返回栏
}
... ...
... ... @@ -2,6 +2,8 @@
* page接口返回的Page数据DTO
*/
import { AdvRuleBean, CompAdvBean } from '../adv/AdvsRuleBean';
import { ArrayList } from '@kit.ArkTS';
import { CompDTO } from '../component/CompDTO';
export interface PageInfoDTO {
pageId: string; // 页面id
... ... @@ -27,6 +29,18 @@ export interface PageInfoDTO {
*/
cornersAdv2: CompAdvBean[]
// 本地字段
/*
记录一次请求获取到的楼层comp数据,如 完成一次刷新到结束,获取所有楼层的稿件数据
*/
oneRequestPageGroupCompList: ArrayList<CompDTO>
/*
记录页面楼层所有的信息流广告数据
*/
pageAdList:CompAdvBean[]
}
export interface ChannelInfoDTO {
... ...
... ... @@ -87,3 +87,5 @@ export { WDLiveViewDefaultType } from "./src/main/ets/components/view/LiveEmptyC
export { LiveFollowComponent } from "./src/main/ets/components/cardCommon/LiveFollowComponent"
export { publishCommentModel } from './src/main/ets/components/comment/model/PublishCommentModel';
... ...
... ... @@ -16,6 +16,7 @@ import { Card17Component } from './cardview/Card17Component';
import { Card19Component } from './cardview/Card19Component';
import { Card20Component } from './cardview/Card20Component';
import { Card21Component } from './cardview/Card21Component';
import { SearchContentComponent } from './cardview/SearchContentComponent';
/**
* card适配器,卡片样式汇总,依据ContentDTO#appStyle
... ... @@ -24,31 +25,35 @@ import { Card21Component } from './cardview/Card21Component';
@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, compDTO: this.compDTO })
} 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) {
... ... @@ -58,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) {
... ... @@ -73,4 +78,5 @@ export struct CardParser {
// .backgroundColor(Color.Brown) // 展示本页未实现的compStyle
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -30,10 +30,13 @@ export struct CarderInteraction {
this.likeBean['title'] = this.contentDetailData.newsTitle + ''
this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + ''
this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
this.contentDTO.shareFlag = this.contentDTO.shareFlag?this.contentDTO.shareFlag:'1'
console.log('是否显示分享',this.contentDTO.shareFlag)
}
build() {
Row() {
if(this.contentDTO.shareFlag === '1'){
Row() {
Image($r('app.media.CarderInteraction_share'))
.width(18)
... ... @@ -47,6 +50,8 @@ export struct CarderInteraction {
.onClick(() => {
WDShare.shareContent(this.contentDetailData)
})
}
Row() {
Image($r('app.media.CarderInteraction_comment'))
... ... @@ -66,11 +71,11 @@ export struct CarderInteraction {
}
.width('100%')
.margin({ top: 11 })
.padding({
left: 21,
right: 21
})
.justifyContent(FlexAlign.SpaceBetween)
// .padding({
// left: 21,
// right: 21
// })
.justifyContent(FlexAlign.SpaceAround)
.alignItems(VerticalAlign.Center)
}
... ...
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 { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01';
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';
/**
* 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
... ...
... ... @@ -74,6 +74,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()
... ... @@ -106,7 +107,7 @@ export struct DynamicDetailComponent {
//分割线
Image($r('app.media.ic_news_detail_division'))
.width('100%')
.height($r('app.float.margin_7'))
.height($r('app.float.margin_12'))
.padding({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') })
Stack({ alignContent: Alignment.Bottom }) {
if (!this.isNetConnected) {
... ... @@ -279,12 +280,18 @@ export struct DynamicDetailComponent {
}
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(14)
.height(14)
.width(12)
.height(12)
.margin({ right: 4 })
Text('长图')
.fontSize(12)
.fontSize(10)
.fontWeight(400)
.textShadow({
radius: 1,
color: `rgba(0,0,0,0.5)`,
offsetY:1,
offsetX:1
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
}
... ... @@ -292,6 +299,7 @@ export struct DynamicDetailComponent {
.padding({ bottom: 9 })
}
}
.onClick(async (event: ClickEvent) => {
let retvalue = await FastClickUtil.isMinDelayTime()
... ... @@ -326,9 +334,33 @@ export struct DynamicDetailComponent {
GridCol({
span: { xs: 4 }
}) {
Stack({alignContent: Alignment.BottomEnd}) {
Image(item.picPath)
.aspectRatio(1)
.borderRadius(this.caclImageRadius(index))
if(this.getPicType(item) !== 3){
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(12)
.height(12)
.margin({ right: 4 })
Text('长图')
.fontSize(10)
.fontWeight(400)
.textShadow({
radius: 1,
color: `rgba(0,0,0,0.5)`,
offsetY:1,
offsetX:1
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
}
.width(48)
.align(Alignment.BottomEnd)
.padding({ bottom: 3 })
}
}
}
.onClick(async (event: ClickEvent) => {
let retvalue = await FastClickUtil.isMinDelayTime()
... ... @@ -341,9 +373,33 @@ export struct DynamicDetailComponent {
GridCol({
span: { sm: 4, lg: 3 }
}) {
Stack({alignContent: Alignment.BottomEnd}) {
Image(item.picPath)
.aspectRatio(1)
.borderRadius(this.caclImageRadius(index))
if(this.getPicType(item) !== 3){
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(12)
.height(12)
.margin({ right: 4 })
Text('长图')
.fontSize(10)
.fontWeight(400)
.textShadow({
radius: 1,
color: `rgba(0,0,0,0.5)`,
offsetY:1,
offsetX:1
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
}
.width(48)
.align(Alignment.BottomEnd)
.padding({ bottom: 3})
}
}
}
.onClick(async (event: ClickEvent) => {
let retvalue = await FastClickUtil.isMinDelayTime()
... ... @@ -481,15 +537,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)
... ... @@ -506,7 +554,7 @@ export struct DynamicDetailComponent {
OperRowListView({
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
operationButtonList: ['comment', 'collect', 'share'],
operationButtonList: this.operationButtonList,
styleType: 1,
})
... ... @@ -523,13 +571,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;
... ... @@ -539,6 +580,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;
... ... @@ -642,10 +697,10 @@ export struct DynamicDetailComponent {
}
getPicType(item: PhotoListBean) {
if (item.width && item.width) {
if (item.width / item.height > 343 / 172) {
if (item.width && item.height) {
if (item.width / item.height > 2/1) {
return 1; //横长图
} else if (item.height / item.width > 305 / 228) {
} else if (item.width / item.height < 1/2) {
return 2; //竖长图
} else {
return 3
... ... @@ -654,7 +709,6 @@ export struct DynamicDetailComponent {
return 3; //普通图
}
}
/**
* 关注号主
*/
... ...
... ... @@ -55,6 +55,7 @@ export struct ENewspaperPageComponent {
alignment: DialogAlignment.Top,
offset: { dx: 0, dy: 80 },
customStyle: true,
maskColor: $r('app.color.color_80000000'),
})
//图片版选择弹框
pageDialogController: CustomDialogController = new CustomDialogController({
... ... @@ -65,6 +66,7 @@ export struct ENewspaperPageComponent {
alignment: DialogAlignment.BottomStart,
offset: { dx: 0, dy: -90 },
customStyle: true,
maskColor: $r('app.color.color_80000000'),
})
//文字报纸弹框
@State isOpenListDialog: boolean = false
... ...
... ... @@ -52,35 +52,11 @@ export struct ImageAndTextPageComponent {
@State isNetConnected: boolean = true
@State info: Area | null = null
@State likeNum: number = 0
@State reachEndIncreament : number = 0
@State reachEndIncreament: number = 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
build() {
Column() {
// 发布时间
Row() {
Image(this.contentDetailData?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb'))
.width(80)
.height(28)
Text(this.publishTime)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize(13)
}
.width(CommonConstants.FULL_WIDTH)
.height(32)
.padding({ left: 15, right: 15, })
.justifyContent(FlexAlign.SpaceBetween)
.alignItems(VerticalAlign.Bottom)
Row() {
Image($r('app.media.line'))
.width('100%')
.height(6)
.objectFit(ImageFit.Cover)
.margin({ top: 10 })
}
.padding({ left: 15, right: 15 })
.backgroundColor(Color.White)
Stack({ alignContent: Alignment.Top }) {
Stack({ alignContent: Alignment.Bottom }) {
Scroll(this.scroller) {
Column() {
... ... @@ -89,7 +65,7 @@ export struct ImageAndTextPageComponent {
action: this.action,
isPageEnd: $isPageEnd
})
.padding({ bottom: 10 })
.padding({ top: 15, bottom: 10 })
Column() {
// 点赞
if (this.contentDetailData?.openLikes && this.contentDetailData?.likesStyle !== 4) {
... ... @@ -156,11 +132,9 @@ export struct ImageAndTextPageComponent {
}
}
}
}
.width(CommonConstants.FULL_WIDTH)
// .height(CommonConstants.FULL_HEIGHT)
.padding({ bottom: 76 })
.height(CommonConstants.FULL_HEIGHT)
.scrollBar(BarState.Off)
.align(Alignment.Top)
.onReachEnd(() => {
... ... @@ -177,20 +151,49 @@ export struct ImageAndTextPageComponent {
}).padding({ bottom: 200 })
} else {
if (!this.isPageEnd) {
detailedSkeleton()
detailedSkeleton().padding({ bottom: this.bottomSafeHeight })
}
}
//底部交互区
if (this.operationButtonList.length) {
// 底部交互区
OperRowListView({
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
operationButtonList: this.operationButtonList,
styleType: 1,
})
.position({y: '100%'})
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.padding({ top: 38 })
// 发布时间
Column() {
Row() {
Image(this.contentDetailData?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb'))
.width(80)
.height(28)
Text(this.publishTime)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize(13)
}
.width(CommonConstants.FULL_WIDTH)
.height(32)
.padding({ left: 15, right: 15, })
.justifyContent(FlexAlign.SpaceBetween)
.alignItems(VerticalAlign.Bottom)
Row() {
Image($r('app.media.line'))
.width('100%')
.height(6)
.objectFit(ImageFit.Cover)
.margin({ top: 10 })
}
.padding({ left: 15, right: 15 })
.backgroundColor(Color.White)
}.backgroundColor(Color.White)
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
... ... @@ -231,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) {
... ... @@ -260,7 +263,11 @@ export struct ImageAndTextPageComponent {
channelId: String(this.contentDetailData?.reLInfo?.channelId)
}
let recommendList = await DetailViewModel.postRecommendList(params)
this.recommendList = recommendList;
if (recommendList.length > 0) {
//推荐列表过滤音频和活动入口
this.recommendList = recommendList.filter(item => item.objectType !== '3' && item.objectType !== '13');
}
}
// 已登录->查询用户对作品点赞、收藏状态
... ...
... ... @@ -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 = ''
... ... @@ -96,6 +95,7 @@ export struct ImageAndTextWebComponent {
Column() {
WdWebLocalComponent({
webviewControl: this.webviewControl,
reload:this.reload,
webResource: $rawfile('apph5/index.html'),
backVisibility: false,
onWebPrepared: this.onWebPrepared.bind(this),
... ...
... ... @@ -25,6 +25,7 @@ export struct ImageDownloadComponent {
build() {
Column() {
SaveButton({ icon: SaveIconStyle.LINES })
.iconSize(24)
.iconColor(Color.White)
.onClick(async () => {
console.info(`cj2024 onClick ${this.imageBuffer}`)
... ...
import { ContentDTO } from 'wdBean/Index';
import { ProcessUtils } from 'wdRouter/Index';
import { InteractMessageModel } from '../../model/InteractMessageModel'
import { DateTimeUtils} from 'wdKit/Index'
@Component
export struct InteractMComponent {
messageModel:InteractMessageModel = new InteractMessageModel;
... ... @@ -15,6 +15,7 @@ export struct InteractMComponent {
build() {
Row(){
Image(this.messageModel.InteractMsubM.headUrl)
.alt($r('app.media.default_head'))
.width(36)
.height(36)
.borderRadius(18)
... ... @@ -29,7 +30,7 @@ export struct InteractMComponent {
.margin({left:5})
}.width('100%')
Text(this.messageModel.time)
Text(this.getPublishTime(this.messageModel.time,DateTimeUtils.getDateTimestamp(this.messageModel.time)+""))
.margin({top:2})
.fontSize('12fp').fontColor('#B0B0B0').margin({top:10,bottom:10})
... ... @@ -41,6 +42,7 @@ export struct InteractMComponent {
.constraintSize({maxHeight:500})
}
if(this.messageModel.contentType != '211'){
Column(){
if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){
Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500})
... ... @@ -77,6 +79,7 @@ export struct InteractMComponent {
contentDTO.objectId = this.messageModel.InteractMsubM.contentId
ProcessUtils.processPage(contentDTO)
})
}
}.padding({left:5,right:5}).alignItems(HorizontalAlign.Start).width('90%')
}.padding({top:10,left:16,right:16}).width('100%').alignItems(VerticalAlign.Top)
}
... ... @@ -102,4 +105,49 @@ export struct InteractMComponent {
let contentString : string = this.messageModel.contentType === '207'?this.messageModel.message:this.messageModel.InteractMsubM.beReply;
return contentString;
}
getPublishTime(data:string,publishTime: string): string {
const publishTimestamp = parseInt(publishTime)
const currentTime = Date.now(); // 当前时间戳
// 计算差异
const timeDifference = currentTime - publishTimestamp;
// 转换为分钟、小时和天
const minutes = Math.floor(timeDifference / (1000 * 60));
const hours = Math.floor(timeDifference / (1000 * 60 * 60));
const days = Math.floor(timeDifference / (1000 * 60 * 60 * 24));
// 根据时间差返回对应的字符串
let result: string;
if (minutes < 60) {
result = `${minutes}分钟前`;
if (minutes === 0) {
result = `刚刚`;
}
} else if (hours < 24) {
result = `${hours}小时前`;
} else {
result = `${days}天前`;
if (days > 1) {
let arr = data.split(" ")
if (arr.length === 2) {
let arr2 = arr[0].split("-")
if (arr2.length === 3) {
result = `${arr2[1]}-${arr2[2]}`
}
} else {
//原始数据是时间戳 需要转成dateString
let time = DateTimeUtils.formatDate(Number(publishTime))
let arr = time.split("-")
if (arr.length === 3) {
result = `${arr[1]}-${arr[2]}`
}
}
}
}
console.log(result);
return result
}
}
\ No newline at end of file
... ...
... ... @@ -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';
... ... @@ -77,7 +79,7 @@ export struct MorningEveningPaperComponent {
offset: { dx: 12, dy: -150 },
})
private AudioSuspension = new AudioSuspensionModel()
// private AudioSuspension = new AudioSuspensionModel()
onCancel() {
Logger.info(TAG, "cj2024 onCancel = ")
... ... @@ -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)
... ... @@ -145,6 +151,7 @@ export struct MorningEveningPaperComponent {
if (this.compListItem.operDataList && this.compListItem.operDataList.length > 0) {
this.getAllContentInteractData(this.compListItem.operDataList)
}
Logger.debug('compInfoBean?.compList[0].audioDataList', JSON.stringify(compInfoBean?.compList[0].audioDataList))
if (compInfoBean?.compList[0].audioDataList) {
this.audioPlayUrl = compInfoBean?.compList[0].audioDataList[0].audioUrl
this.audioTitle = compInfoBean?.compList[0].audioDataList[0].title
... ... @@ -305,8 +312,9 @@ export struct MorningEveningPaperComponent {
.onClick(() => {
Logger.info("TAG", "cj compInfoBean onClick1 = " + this.isAudioPlaying)
// dialog.open()
this.AudioSuspension.showWindow()
// this.playerController.firstPlay(this.audioPlayUrl)
// this.playerController.firstPlay(this.audioPlayUrl, this.audioTitle)
// this.AudioSuspension.setPlayerUrl(this.audioPlayUrl, this.audioTitle)
Logger.info(TAG, "this.audioPlayUrl = " + this.audioPlayUrl)
Logger.info("TAG", "cj compInfoBean onClick2 = " + this.isAudioPlaying)
})
}
... ...
... ... @@ -366,6 +366,8 @@ export struct MultiPictureDetailPageComponent {
publishCommentModel: this.publishCommentModel,
operationButtonList: this.operationButtonList,
styleType: 2,
componentType: 5,
pageComponentType: 3
})
}
.transition(TransitionEffect.OPACITY.animation({ duration: this.duration, curve: Curve.Ease }).combine(
... ... @@ -443,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) {
... ...
... ... @@ -8,6 +8,8 @@ import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5
import { OperRowListView } from './view/OperRowListView';
import DetailViewModel from '../viewmodel/DetailViewModel';
import { publishCommentModel } from '../components/comment/model/PublishCommentModel';
import { EmptyComponent } from '../components/view/EmptyComponent';
import { NetworkUtil, WindowModel } from 'wdKit';
const TAG: string = 'SpacialTopicPageComponent'
... ... @@ -18,12 +20,15 @@ export struct SpacialTopicPageComponent {
action: Action = {} as Action
@State webUrl: string = '';
@State isPageEnd: boolean = false
@Prop reload: number = 0;
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
private webPrepared = false;
private dataPrepared = false;
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State operationButtonList: string[] = ['comment', 'collect', 'share']
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State isNetConnected: boolean = true
private trySendData2H5() {
if (!this.webPrepared || !this.dataPrepared) {
... ... @@ -45,6 +50,8 @@ export struct SpacialTopicPageComponent {
}
private async getDetail() {
this.isNetConnected = NetworkUtil.isNetConnected()
let contentId: string = ''
let relId: string = ''
let relType: string = ''
... ... @@ -66,13 +73,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()
}
... ... @@ -83,20 +90,39 @@ export struct SpacialTopicPageComponent {
Column() {
Stack({ alignContent: Alignment.Bottom }) {
Column() {
Text(this.contentDetailData?.newsTitle)
.backgroundColor(Color.White)
.width('100%')
.height(40)
.fontSize(18)
.textAlign(TextAlign.Center)
.fontWeight(500)
.visibility(this.action?.params?.backVisibility && this.isPageEnd ? Visibility.Visible : Visibility.None)
WdWebComponent({
webviewControl: this.webviewControl,
webUrl: this.webUrl,
backVisibility: false,
reload: this.reload,
onWebPrepared: this.onWebPrepared.bind(this),
isPageEnd: $isPageEnd
isPageEnd: $isPageEnd,
})
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.padding({ bottom: 75 })
.padding({ bottom: this.action?.params?.backVisibility ? 115 : 75 })
if (!this.isNetConnected) {
EmptyComponent({
emptyType: 1,
emptyButton: true,
retry: () => {
this.getDetail()
}
}).padding({ bottom: 200 })
} else {
if (!this.isPageEnd) {
detailedSkeleton()
detailedSkeleton().padding({ bottom: this.bottomSafeHeight })
}
}
//底部交互区
OperRowListView({
... ... @@ -109,9 +135,16 @@ export struct SpacialTopicPageComponent {
}
aboutToAppear() {
if (this.action) {
this.webUrl = this.action.params?.url || ''
if (!this.action?.params?.backVisibility) {
WindowModel.shared.setWindowLayoutFullScreen(true)
}
this.webUrl = this.action?.params?.url || ''
this.getDetail()
}
aboutToDisappear() {
if (!this.action?.params?.backVisibility) {
WindowModel.shared.setWindowLayoutFullScreen(false)
}
}
}
... ...
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() {
if (this.contentDTO.corner) {
Text(this.contentDTO.corner)
.fontSize($r("app.float.font_size_12"))
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_ED2800"))
.margin({ right: 2 })
}
if (this.contentDTO.rmhPlatform === 1) {
Text(this.contentDTO.rmhInfo?.rmhName)
.fontSize($r("app.float.font_size_12"))
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_B0B0B0"))
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
} else if (this.contentDTO.source) {
Text(`${this.contentDTO.source}`)
.fontSize($r("app.float.font_size_12"))
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_B0B0B0"))
.maxLines(1)
.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)
.height(16)
}
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
.fontSize($r("app.float.font_size_12"))
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_B0B0B0"))
.flexShrink(0)
}
if (this.contentDTO?.interactData?.commentNum) {
Text(`${this.contentDTO.interactData.commentNum}评`)
.fontSize($r("app.float.font_size_12"))
if (this.getContentDtoBean()?.interactData?.commentNum) {
Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`)
.fontSize($r("app.float.font_size_11"))
.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 this.contentDTO
}
if(this.compDTO.operDataList.length == 0){
return this.contentDTO
}
return this.compDTO.operDataList[0]
}
}
\ No newline at end of file
... ...
... ... @@ -13,11 +13,13 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import router from '@ohos.router'
import { postBatchAttentionStatusParams } from 'wdBean/Index';
import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
@Component
export struct RmhTitle {
@Prop rmhInfo: RmhInfoDTO
@Prop publishTime: string | undefined
@State loadImg: boolean = false;
/**
* 是否需要隐藏发布时间超过2天的时间展示,默认不隐藏
*/
... ... @@ -76,13 +78,15 @@ export struct RmhTitle {
}
}
aboutToAppear(): void {
async aboutToAppear(): Promise<void> {
this.getBatchAttentionStatus()
let page = router.getState();
if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) {
this.hideTime = true;
}
this.loadImg = await onlyWifiLoadImg();
}
getDaysBetweenDates(date: number) {
... ... @@ -96,10 +100,10 @@ export struct RmhTitle {
build() {
Flex() {
Stack() {
Image(this.rmhInfo.rmhHeadUrl)
Image(this.loadImg ? this.rmhInfo?.rmhHeadUrl : $r('app.media.comment_rmh_tag'))
.width(36)
.height(36).borderRadius(50)
Image(this.rmhInfo.authIcon)
Image(this.rmhInfo?.authIcon)
.width(14)
.height(14)
.borderRadius(50)
... ... @@ -109,7 +113,7 @@ export struct RmhTitle {
.flexShrink(0)
Column() {
Text(this.rmhInfo.rmhName)
Text(this.rmhInfo?.rmhName)
.fontSize($r('app.float.font_size_13'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
... ... @@ -122,13 +126,13 @@ export struct RmhTitle {
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
}
if (this.publishTime && this.rmhInfo.rmhDesc) {
if (this.publishTime && this.rmhInfo?.rmhDesc) {
Image($r('app.media.point'))
.width(16)
.height(16)
}
}
Text(this.rmhInfo.rmhDesc)
Text(this.rmhInfo?.rmhDesc)
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
.maxLines(1)
... ... @@ -141,7 +145,7 @@ export struct RmhTitle {
}
Blank()
if (this.rmhInfo.cnIsAttention) {
if (this.rmhInfo?.cnIsAttention) {
Row() {
if (Number(this.followStatus) === 0) {
Image($r('app.media.rmh_follow'))
... ...
... ... @@ -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 && a.matInfo.originalPostion == b.matInfo.originalPostion) {
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';
... ...
... ... @@ -66,14 +66,13 @@ export struct CardAdvTop {
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 && a.matInfo.originalPostion == b.matInfo.originalPostion) {
currentIndex = i
break;
}
}
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,18 +16,42 @@ 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 = '';
@State str03: string = '';
async aboutToAppear(): Promise<void> {
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
Column() {
// 顶部标题,最多两行
if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) {
Text(this.contentDTO.newsTitle)
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.width(CommonConstants.FULL_WIDTH)
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontWeight(600)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
... ... @@ -110,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 { CommonConstants } from 'wdConstant'
import { ContentDTO } from 'wdBean'
import { CompDTO, ContentDTO } from 'wdBean'
import { DateTimeUtils } from 'wdKit'
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
const TAG = 'Card11Component';
/**
... ... @@ -13,17 +15,57 @@ 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 = '';
@State str03: string = '';
async aboutToAppear(): Promise<void> {
this.titleInit();
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
Column() {
Text(this.contentDTO.newsTitle)
.fontSize($r("app.float.font_size_16"))
Stack() {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags })
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r("app.float.font_size_18"))
.fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222"))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.width(CommonConstants.FULL_WIDTH)
.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'),
... ...
... ... @@ -14,8 +14,22 @@ const TAG = 'Card12Component';
export struct Card12Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State clicked: boolean = false;
@State titleMarked: boolean = false;
@State str01: string = '';
@State str02: string = '';
@State str03: string = '';
aboutToAppear(): void {
this.titleInit();
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
... ... @@ -26,8 +40,17 @@ export struct Card12Component {
}
// 标题
if (this.contentDTO.newsTitle) {
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(3)
... ... @@ -37,7 +60,6 @@ export struct Card12Component {
.fontFamily('PingFang SC-Regular')
}
CarderInteraction({contentDTO: this.contentDTO})
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
... ...
... ... @@ -16,11 +16,25 @@ export struct Card14Component {
@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 = '';
async aboutToAppear(): Promise<void> {
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
Column() {
// rmh信息
... ... @@ -30,8 +44,17 @@ export struct Card14Component {
// 左标题,右图
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) {
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.textOverflowStyle(3)
.lineHeight(25)
... ...
... ... @@ -20,11 +20,24 @@ export struct Card15Component {
@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 = '';
async aboutToAppear(): Promise<void> {
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
Column() {
... ... @@ -32,8 +45,17 @@ export struct Card15Component {
RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime })
//新闻标题
if (this.contentDTO.newsTitle) {
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(2)
... ...
... ... @@ -21,11 +21,25 @@ export struct Card16Component {
@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 = '';
async aboutToAppear(): Promise<void> {
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
Column() {
// rmh信息
... ... @@ -34,8 +48,17 @@ export struct Card16Component {
}
// 标题
if (this.contentDTO.newsTitle) {
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(2)
... ...
import { Action, CompDTO, ContentDTO, Params } from 'wdBean';
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
import { CommonConstants } from 'wdConstant/Index';
import { DateTimeUtils } from 'wdKit';
import { WDRouterRule } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
const TAG = 'Card17Component';
... ... @@ -14,21 +13,43 @@ 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 = '';
@State str03: string = '';
async aboutToAppear(): Promise<void> {
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
Column({ space: 8 }) {
Text(this.contentDTO.newsTitle)
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.lineHeight(25)
.maxLines(3)
... ... @@ -38,10 +59,11 @@ export struct Card17Component {
// 三个图,
GridRow({ gutter: 2 }) {
GridCol({ span: { xs: 8 } }) {
Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 0 ?this.contentDTO.fullColumnImgUrls[0].url:'' : '')
Image(this.loadImg ?
this.contentDTO.fullColumnImgUrls.length > 0 ? this.contentDTO.fullColumnImgUrls[0].url : '' : '')
.backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.height(160)// .aspectRatio(CompUtils.ASPECT_RATIO_16_9)
.borderRadius({
topLeft: $r('app.float.image_border_radius'),
bottomLeft: $r('app.float.image_border_radius'),
... ... @@ -49,10 +71,11 @@ export struct Card17Component {
}
GridCol({ span: { xs: 4 } }) {
Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 1? this.contentDTO.fullColumnImgUrls[1].url:'' : '')
Image(this.loadImg ?
this.contentDTO.fullColumnImgUrls.length > 1 ? this.contentDTO.fullColumnImgUrls[1].url : '' : '')
.backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.height(79)// .aspectRatio(CompUtils.ASPECT_RATIO_16_9)
.margin({ bottom: 1 })
.borderRadius({
topRight: $r('app.float.image_border_radius'),
... ... @@ -65,10 +88,11 @@ export struct Card17Component {
}
GridCol({ span: { xs: 4 } }) {
Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 2? this.contentDTO.fullColumnImgUrls[2].url:'' : '')
Image(this.loadImg ?
this.contentDTO.fullColumnImgUrls.length > 2 ? this.contentDTO.fullColumnImgUrls[2].url : '' : '')
.backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.height(79)// .aspectRatio(CompUtils.ASPECT_RATIO_16_9)
.margin({ top: 1 })
.borderRadius({
bottomRight: $r('app.float.image_border_radius'),
... ... @@ -94,8 +118,9 @@ export struct Card17Component {
};
WDRouterRule.jumpWithAction(taskAction)
})
// 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
CardSourceInfo({compDTO:this.compDTO, contentDTO: this.contentDTO })
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ... @@ -106,3 +131,11 @@ export struct Card17Component {
})
}
}
// 全局公共样式
@Styles
function ImageSize() {
.padding({ right: 18, left: 18 })
.width('100%')
.margin({ top: 10 })
}
\ No newline at end of file
... ...
... ... @@ -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';
... ... @@ -14,6 +14,24 @@ const TAG = 'Card19Component';
export struct Card19Component {
@State contentDTO: ContentDTO = new ContentDTO()
@State clicked: boolean = false;
@State titleMarked: boolean = false;
@State str01: string = '';
@State str02: string = '';
@State str03: string = '';
async aboutToAppear(): Promise<void> {
this.titleInit();
console.log('card19',JSON.stringify(this.contentDTO))
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
Column() {
... ... @@ -21,12 +39,22 @@ export struct Card19Component {
RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime })
// 标题
if (this.contentDTO.newsTitle) {
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.textOverflowStyle(3)
.margin({ bottom: 8 })
.width(CommonConstants.FULL_WIDTH)
.lineHeight(25)
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
... ... @@ -39,16 +67,16 @@ export struct Card19Component {
const photo: PhotoListBean = {
width: item.weight,
height: item.height,
picPath: item.fullUrl,
picPath: item.fullUrl||item.url,
picDesc: '',
itemType:2,
id:0
}
return photo
})
ProcessUtils.gotoMultiPictureListPage(photoList,0)
ProcessUtils.gotoMultiPictureListPage(photoList, 0)
})
CarderInteraction({contentDTO: this.contentDTO})
CarderInteraction({ contentDTO: this.contentDTO })
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.padding({
... ... @@ -80,11 +108,12 @@ 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)
}
console.log('card19-this.fullColumnImgUrls',JSON.stringify(this.fullColumnImgUrls))
}
caclImageRadius(index: number) {
... ... @@ -111,10 +140,10 @@ struct createImg {
}
getPicType(){
if (this.picWidth && this.picWidth) {
if (this.picWidth / this.picHeight > 343/172) {
if (this.picWidth && this.picHeight) {
if (this.picWidth / this.picHeight > 2/1) {
return 1; //横长图
} else if (this.picHeight / this.picWidth > 305/228) {
} else if ( this.picWidth/this.picHeight < 1/2) {
return 2; //竖长图
} else {
return 3
... ... @@ -124,7 +153,6 @@ struct createImg {
}
}
build() {
GridRow({
gutter: { x: 2, y: 2 }
... ... @@ -139,14 +167,14 @@ struct createImg {
alignContent: Alignment.BottomEnd
}) {
if (this.getPicType() === 1) {
Image(this.loadImg ? item.fullUrl : '')
Image(this.loadImg ? item.fullUrl||item.url : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.height(172)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
} else if (this.getPicType() === 2) {
Image(this.loadImg ? item.fullUrl : '')
Image(this.loadImg ? item.fullUrl||item.url : '')
.width('100%')
.height(305)
.autoResize(true)
... ... @@ -154,15 +182,20 @@ struct createImg {
}
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(14)
.height(14)
.width(12)
.height(12)
.margin({right: 4})
Text('长图')
.fontSize(12)
.fontSize(10)
.fontWeight(400)
.textShadow({
radius: 1,
color: '#777',
offsetX:1,
offsetY:1
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
.shadow({radius: 4, color: 0xc3cbd5, offsetX: 4, offsetY: 4})
}
.width(48)
.padding({bottom: 9})
... ... @@ -189,19 +222,75 @@ struct createImg {
GridCol({
span: { xs: 4 }
}) {
Stack({alignContent: Alignment.BottomEnd}) {
Image(this.loadImg ? item.fullUrl : '')
.backgroundColor(0xf5f5f5)
.aspectRatio(1)
.borderRadius(this.caclImageRadius(index))
.onComplete(callback => {
this.picWidth = callback?.width || 0;
this.picHeight = callback?.height || 0;
})
if(this.getPicType() !== 3){
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(12)
.height(12)
.margin({ right: 4 })
Text('长图')
.fontSize(10)
.fontWeight(400)
.textShadow({
radius: 1,
color: `rgba(0,0,0,0.5)`,
offsetY:1,
offsetX:1
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
}
.width(48)
.align(Alignment.BottomEnd)
.padding({ bottom: 3 })
}
}
}
} else {
GridCol({
span: { sm: 4, lg: 3 }
}) {
Stack({ alignContent: Alignment.BottomEnd }) {
Image(this.loadImg ? item.fullUrl : '')
.backgroundColor(0xf5f5f5)
.aspectRatio(1)
.borderRadius(this.caclImageRadius(index))
.onComplete(callback => {
this.picWidth = callback?.width || 0;
this.picHeight = callback?.height || 0;
})
if (this.getPicType() !== 3) {
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(12)
.height(12)
.margin({ right: 4 })
Text('长图')
.fontSize(10)
.fontWeight(400)
.textShadow({
radius: 1,
color: `rgba(0,0,0,0.5)`,
offsetY: 1,
offsetX: 1
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
}
.width(48)
.align(Alignment.BottomEnd)
.padding({ bottom: 3 })
}
}
}
}
})
... ...
... ... @@ -15,8 +15,22 @@ const TAG = 'Card20Component';
export struct Card20Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State clicked: boolean = false;
@State titleMarked: boolean = false;
@State str01: string = '';
@State str02: string = '';
@State str03: string = '';
aboutToAppear(): void {
this.titleInit();
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
... ... @@ -25,13 +39,23 @@ export struct Card20Component {
RmhTitle({ rmhInfo: this.contentDTO.rmhInfo, publishTime: this.contentDTO.publishTime })
// 标题
if (this.contentDTO.newsTitle) {
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(3)
.margin({ bottom: 8 })
.lineHeight(20)
.lineHeight(22)
}
if (this.contentDTO.fullColumnImgUrls[0]) {
createImg({ contentDTO: this.contentDTO })
... ...
... ... @@ -16,11 +16,25 @@ export struct Card21Component {
@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 = '';
async aboutToAppear(): Promise<void> {
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
Column() {
// 顶部 rmh信息
... ... @@ -28,8 +42,17 @@ export struct Card21Component {
// 中间内容
Grid() {
GridItem() {
Text(`${this.contentDTO.newsTitle}`)
.fontSize($r('app.float.selected_text_size'))
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontSize(18)
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.maxLines(4)
... ...
//全标题 "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';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
// import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
const TAG: string = 'Card2Component';
/**
... ... @@ -21,9 +21,25 @@ 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 = '';
@State str03: string = '';
async aboutToAppear(): Promise<void> {
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
// this.clicked = hasClicked(this.contentDTO.objectId)
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
... ... @@ -31,18 +47,34 @@ export struct Card2Component {
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(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
.textIndent(this.contentDTO.objectType == '5' ? 35 : 0)
}
.alignContent(Alignment.TopStart)
.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)
//.textIndent(this.contentDTO.objectType == '5' ? 35 : 0)
// }
// .alignContent(Alignment.TopStart)
//大图
Stack() {
... ... @@ -64,7 +96,7 @@ export struct Card2Component {
//bottom
// 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO })
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ... @@ -75,6 +107,7 @@ export struct Card2Component {
})
.onClick((event: ClickEvent) => {
this.clicked = true;
// persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
import { ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant'
import { CommonConstants } from 'wdConstant';
import { CompDTO, ContentDTO } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
/**
* 卡片样式:"appStyle":"3"
... ... @@ -11,15 +12,55 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
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 = '';
@State str03: string = '';
async aboutToAppear(): Promise<void> {
this.titleInit();
// this.clicked = hasClicked(this.contentDTO.objectId)
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
Column() {
Text(this.contentDTO.newsTitle)
.fontSize($r("app.float.font_size_16"))
Stack() {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags })
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.lineHeight(27)
.fontSize($r("app.float.font_size_18"))
.fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222"))
.width(CommonConstants.FULL_WIDTH)
.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';
import { Notes } from './notes';
const TAG: string = 'Card4Component';
/**
... ... @@ -18,22 +19,54 @@ export struct Card4Component {
@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
async aboutToAppear(): Promise<void> {
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
Column() {
//body
Column() {
//新闻标题
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags })
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.textOverflow({ overflow: TextOverflow.Ellipsis })
.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)// 超出的部分显示省略号。
//三图
Stack(){
Row() {
... ... @@ -73,7 +106,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({
... ...
import { ContentDTO } from 'wdBean';
import { ContentDTO, CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { Notes } from './notes';
import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG: string = 'Card5Component';
... ... @@ -13,22 +15,37 @@ const TAG: string = 'Card5Component';
export struct Card5Component {
@State contentDTO: ContentDTO = new ContentDTO();
@Prop titleShowPolicy: number | string
@Prop compDTO: CompDTO = {} as CompDTO
@State loadImg: boolean = false;
@State clicked: boolean = false;
@State titleMarked: boolean = false;
@State str01: string = '';
@State str02: string = '';
@State str03: string = '';
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
this.titleInit();
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
Stack() {
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.backgroundColor(0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.autoResize(true)
.borderRadius($r('app.float.image_border_radius'))
if (this.titleShowPolicy === 1) {
if (this.titleShowPolicy === 1 || this.titleShowPolicy === null) {
Row()
.width(CommonConstants.FULL_WIDTH)
.height(59)
... ... @@ -39,18 +56,32 @@ 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 })
}
Text(this.contentDTO.newsTitle)
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.width(CommonConstants.FULL_WIDTH)
.fontColor(Color.White)
.fontSize($r('app.float.normal_text_size'))
.fontSize($r('app.float.font_size_18'))
.fontWeight(FontWeight.Bold)
.maxLines(2)
.align(Alignment.TopStart)
.textIndent(this.contentDTO.objectType == '5' ? 35 : 0)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.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)
... ... @@ -69,6 +100,8 @@ export struct Card5Component {
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
let context = getContext(this) as common.UIAbilityContext;
viewBlogInsightIntentShare(context, this.contentDTO?.channelId, [this.compDTO], ActionMode.EXECUTED)
})
}
... ...
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 { Logger } from 'wdKit/Index';
const TAG: string = 'Card6Component-Card13Component';
... ... @@ -13,12 +14,28 @@ 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();
this.loadImg = await onlyWifiLoadImg();
// this.clicked = hasClicked(this.contentDTO.objectId)
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
... ... @@ -42,9 +59,19 @@ export struct Card6Component {
Notes({ objectType: this.contentDTO.objectType })
}
Text(`${this.contentDTO.newsTitle}`)
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontColor(this.clicked ? 0x848484 : 0x222222)
.fontSize(16)
.fontSize(18)
.lineHeight(27)
.fontWeight(FontWeight.Normal)
.maxLines(3)
.alignSelf(ItemAlign.Start)
... ... @@ -54,29 +81,30 @@ export struct Card6Component {
this.contentDTO.objectType == '5' ? 30 : 0)
}.alignContent(Alignment.TopStart)
}.height("80%")
}
.justifyContent(FlexAlign.Start)
//bottom 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
CardSourceInfo({ compDTO: this.compDTO,contentDTO:this.contentDTO })
}
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Start)
.width('58%')
.width('64%')
Stack() {
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.borderRadius(5)
.aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4)
.height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180)
.height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156)
CardMediaInfo({ contentDTO: this.contentDTO })
}
.alignContent(Alignment.BottomEnd)
}
.onClick((event: ClickEvent) => {
this.clicked = true;
// persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
})
.padding({
... ... @@ -86,7 +114,7 @@ export struct Card6Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.width(CommonConstants.FULL_WIDTH)
.height(this.contentDTO.appStyle === CompStyle.Card_13 ? 127 : 217)
.height(this.contentDTO.appStyle === CompStyle.Card_13 ? 107 : 217)
.justifyContent(FlexAlign.SpaceBetween)
}
}
\ No newline at end of file
... ...
... ... @@ -15,29 +15,63 @@ export struct Card9Component {
@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 = '';
async aboutToAppear(): Promise<void> {
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
Column() {
// 顶部标题,最多两行
if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) {
Text(this.contentDTO.newsTitle)
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags })
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontColor(this.clicked ? 0x848484 : 0x222222)
.width(CommonConstants.FULL_WIDTH)
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontWeight(600)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ bottom: 19 })
.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)
}
// 大图
Stack() {
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')
... ... @@ -78,7 +112,7 @@ export struct Card9Component {
}
.width(CommonConstants.FULL_WIDTH)
.padding({
top: 14,
top: 5,
left: 16,
right: 16,
bottom: 14
... ...
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';
/**
* 上图下文,用于搜索页命中搜索内容展示
*/
@Component
export struct SearchContentComponent {
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
@State str01: string = '';
@State str02: string = '';
@State str03: string = '';
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
this.titleInit();
}
titleInit() {
this.str01 = this.contentDTO.contentText?.split('<em>')[0] || '';
this.str02 = this.contentDTO.contentText?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.contentText?.split('<em>')[1].split('</em>')[1] || '';
}
build() {
Column() {
//body
Column() {
//新闻标题
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
// 命中内容
Text(this.contentDTO.contentText) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
}
.fontSize(13)
.width(CommonConstants.FULL_PARENT)
.margin({ top: 8 })
.fontColor(0x222222)
}
.width('100%')
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Start)
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
//bottom 评论等信息
CardSourceInfo({compDTO:new CompDTO, contentDTO: this.contentDTO })
}
.width(CommonConstants.FULL_WIDTH)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
}
}
@Extend(Text)
function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
}
\ No newline at end of file
... ...
... ... @@ -68,7 +68,7 @@ export class commentItemModel {
fromUserHeader: string = ''
fromUserId: string = ''
fromUserName: string = ''
fromUserType: WDPublicUserType = 0
fromUserType: WDPublicUserType = 1
id: string = ''
likeNum: string = '0'
mySelf: string = ''
... ...
... ... @@ -93,6 +93,9 @@ export struct CommentComponent {
}
});
}
if (model) {
this.isComments = true
}
}
... ...
... ... @@ -11,7 +11,7 @@ export struct CommentTabComponent {
}
@ObjectLink publishCommentModel: publishCommentModel
@Prop contentDetail: ContentDetailDTO
@Prop pageComponentType: number = -1 //1:视频详情页
@Prop pageComponentType: number = -1 //1:视频详情页 2:竖屏直播页
/*展示类型*/
@State type: number = 1
@State placeHolder: string = '说两句...'
... ... @@ -43,6 +43,17 @@ export struct CommentTabComponent {
}
getCommentInputBackImg() {
if (this.pageComponentType === 2) {
return $r('app.media.comment_img_input_black')
} else if (this.pageComponentType === 3) {
return $r('app.media.comment_img_input_hui1')
} else {
return $r('app.media.comment_img_input_hui')
}
}
build() {
Row() {
Stack({ alignContent: Alignment.Start }) {
... ... @@ -67,7 +78,7 @@ export struct CommentTabComponent {
})
.id("RowBg")
} else {
Image($r('app.media.comment_img_input_hui'))
Image(this.getCommentInputBackImg())
.objectFit(ImageFit.Fill)
.resizable({
slice: {
... ... @@ -145,7 +156,7 @@ export struct CommentIconComponent {
// Stack({alignContent:Alignment.Start}) {
if (Number.parseInt(this.publishCommentModel.totalCommentNumer) != 0) {
RelativeContainer() {
Image($r('app.media.comment_icon_number_bg'))
Image(this.styleType == 1 ? $r('app.media.comment_icon_number_bg'):$r('app.media.ic_like_back_Select'))
.objectFit(ImageFit.Fill)
.resizable({
slice: {
... ... @@ -179,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
// })
... ...
... ... @@ -3,8 +3,8 @@ import curves from '@ohos.curves';
import { BusinessError } from '@ohos.base';
import display from '@ohos.display';
const collapseString = '...展开全文'
const uncollapseString = '...收起'
const collapseString = '...展开'
const uncollapseString = ' 收起'
const TestLongText = "超过三行超\n过三行超过\n三行超超过三行\n超过三行超过三行超过三\n行超过"
... ... @@ -129,7 +129,9 @@ export struct CommentText {
// Stack({ alignContent: Alignment.BottomEnd }) {
Text(this.longMessage) {
Span(this.expandedStates ? this.longMessage : this.maxLineMesssage)
Span(this.collapseText).onClick(() => {
Span(this.collapseText)
.fontColor("#999999")
.onClick(() => {
if (this.collapseText == collapseString) {
this.collapseText = uncollapseString;
this.expandedStates = true;
... ...
... ... @@ -26,7 +26,7 @@ export struct QualityCommentsComponent {
private scroller: Scroller = new Scroller();
@State tileOpacity: number = 0;
firstPositionY: number = 0;
bottomSafeHeight: string = AppStorage.get<number>('bottomSafeHeight') + 'px';
bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0;
topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
lastWindowColor: string = '#ffffff'
currentWindowColor: string = '#FF4202'
... ... @@ -38,20 +38,19 @@ export struct QualityCommentsComponent {
aboutToDisappear(): void {
const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
windowClass.setWindowBackgroundColor(this.lastWindowColor)
windowClass.setWindowLayoutFullScreen(false)
// windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' })
this.dialogController = null // 将dialogController置空
}
onPageShow(): void {
WindowModel.shared.setWindowLayoutFullScreen(true)
}
aboutToAppear(): void {
onPageHide(): void {
WindowModel.shared.setWindowLayoutFullScreen(false)
}
this.fullScreen();
aboutToAppear(): void {
this.getData();
this.showAlert()
}
... ... @@ -100,13 +99,6 @@ export struct QualityCommentsComponent {
})
}
fullScreen() {
const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
windowClass.setWindowLayoutFullScreen(true)
}
@Builder
titleHeader() {
Row() {
... ... @@ -247,9 +239,9 @@ export struct QualityCommentsComponent {
ListItem() {
if (this.hasMore === false) NoMoreLayout()
}
ListItem() {
}.height(this.bottomSafeHeight)
// ListItem() {
//
// }.height(`${this.bottomSafeHeight}` + 'px')
}.onReachEnd(()=>{
this.currentPage++
this.getData()
... ... @@ -257,8 +249,7 @@ export struct QualityCommentsComponent {
.margin({ top: 196 })
.height("100%")
.width("100%")
// .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
.edgeEffect(EdgeEffect.Spring)
.edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
... ... @@ -352,7 +343,7 @@ struct QualityCommentItem {
Row() {
Row() {
Image($r('app.media.comment_img_link')).width(16).height(16)
Text(this.item.shareInfo.shareTitle)
Text(this.item.targetTitle)
.fontSize(14)
.fontColor('#666666')
.margin({ left: 6, right: 12 })
... ...
... ... @@ -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> = {};
... ... @@ -485,10 +485,13 @@ class CommentViewModel {
jumpToAccountPage(commentItem: commentItemModel) {
let url = HttpUrlUtils.getOtherUserDetailDataUrl()
let item : Record<string, string >= {
"creatorId": commentItem.fromCreatorId || "",
"userType": `${commentItem.fromUserType}`,
"userId": commentItem.fromUserId || "-1",
let item : Record<string, string >= {}
if (commentItem.fromCreatorId) {
item["creatorId"] = commentItem.fromCreatorId
} else {
item["userType"] = `${commentItem.fromUserType}`
item["userId"] = commentItem.fromUserId
}
HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => {
if (!result.data || result.data.mainControl != 1) {
... ...
... ... @@ -208,7 +208,7 @@ struct CarouselLayout01CardView {
Text(`${this.item.corner}${this.item.newsTitle}`)
.width(CommonConstants.FULL_PARENT)
.fontColor(Color.White)
.fontSize($r('app.float.font_size_16'))
.fontSize($r('app.float.font_size_18'))
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Start)
.align(Alignment.Bottom)
... ... @@ -231,7 +231,7 @@ struct CarouselLayout01CardView {
.height(CommonConstants.FULL_PARENT)
}
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(CompUtils.ASPECT_RATIO_2_1)
.aspectRatio(CompUtils.ASPECT_RATIO_16_9)
.alignContent(Alignment.BottomStart)
.hoverEffect(HoverEffect.Scale)
}
... ...
import { CompDTO, ContentDTO } from 'wdBean';
import { CompDTO, ContentDTO, LiveRoomDataBean } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { Logger } from 'wdKit/Index';
import { ProcessUtils } from 'wdRouter';
... ... @@ -20,6 +20,9 @@ export struct ZhGridLayout02 {
@State compDTO: CompDTO = {} as CompDTO
@State operDataList: ContentDTO[] = []
@State loadImg: boolean = false;
@State liveRoomList: LiveRoomDataBean[] = []
currentPage = 1
pageSize = 12
async aboutToAppear(): Promise<void> {
Logger.debug(TAG, 'aboutToAppear ' + this.compDTO.objectTitle)
... ... @@ -27,14 +30,12 @@ export struct ZhGridLayout02 {
PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => {
this.operDataList = []
this.operDataList.push(...liveReviewDTO.list)
this.getLiveRoomDataInfo(this.operDataList)
})
this.loadImg = await onlyWifiLoadImg();
}
currentPage = 1
pageSize = 12
build() {
Column() {
Scroll() {
... ... @@ -50,12 +51,11 @@ export struct ZhGridLayout02 {
.fontWeight(600)
}
.justifyContent(FlexAlign.Start)
.margin({ top: 8, bottom: 8 })
.margin({ top: 16, bottom: 8 })
.width(CommonConstants.FULL_WIDTH)
GridRow({
gutter: { x: 12, y: 22 },
gutter: { x: 12, y: 13 },
columns: { sm: listSize, md: 2 },
breakpoints: { value: ['320vp', '520vp', '840vp'] }
}) {
... ... @@ -101,12 +101,26 @@ export struct ZhGridLayout02 {
@Builder
buildItemCard(item: ContentDTO) {
Column() {
Stack({ alignContent: Alignment.BottomEnd }) {
Image(this.loadImg ? item.fullColumnImgUrls[0].url : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.height(95)
.borderRadius(4)
if (this.getLiveRoomNumber(item).length > 0) {
Text(this.getLiveRoomNumber(item))
.fontSize('11vp')
.fontWeight(400)
.fontColor(Color.White)
.margin({
right: '5vp',
bottom: '5vp'
})
}
}
Text(item.newsTitle)
.margin({top:'6'})
.fontSize(13)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
... ... @@ -117,14 +131,56 @@ export struct ZhGridLayout02 {
})
}
// 获取评论数
async getLiveRoomDataInfo(list: ContentDTO[]) {
const reserveIds = this.getLiveDetailIds(list)
PageViewModel.getLiveRoomBatchInfo(reserveIds).then((result) => {
if (result && result.length > 0) {
this.liveRoomList.push(...result)
}
}).catch(() => {
})
}
// 判断是否预约
getLiveRoomNumber(item: ContentDTO): string {
const objc = this.liveRoomList.find((element: LiveRoomDataBean) => {
return element.liveId.toString() == item.objectId
})
if (objc && objc.pv && objc.pv > 0) {
return this.computeShowNum(objc.pv)
}
return ''
}
addItems() {
Logger.debug(TAG, 'addItems')
this.currentPage++
PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => {
this.operDataList.push(...liveReviewDTO.list)
this.getLiveRoomDataInfo(this.operDataList)
Logger.debug(TAG, 'addItems after: ' + this.operDataList.length)
})
}
private getLiveDetailIds(list: ContentDTO[]): string {
let idList: string[] = []
list.forEach(item => {
idList.push(item.objectId)
});
return idList.join(',')
}
private computeShowNum(count: number): string {
if (count >= 10000) {
let num = (count / 10000).toFixed(1)
if (Number(num.substring(num.length - 1)) == 0) {
num = num.substring(0, num.length - 2)
}
return num + '万人参加'
}
return `${count}人参加`
}
}
... ...
... ... @@ -59,18 +59,22 @@ 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%')
.onClick((event: ClickEvent) => {
if (item.objectType === '11') {
ProcessUtils.jumpChannelTab(item.objectId, item.pageId)
ProcessUtils.jumpChannelTab(item.objectId, item.pageId, item.newsTitle)
} else {
ProcessUtils.processPage(item)
}
... ...
... ... @@ -57,7 +57,7 @@ export struct ZhSingleColumn04 {
.width(12)
.margin({ left: 12, right: 8 })
Text(item.newsTitle)
.fontSizeColorWeight($r('app.float.font_size_17'), $r('app.color.color_222222'), 400)
.fontSizeColorWeight($r('app.float.font_size_18'), $r('app.color.color_222222'), 400)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.layoutWeight(1)
... ...
... ... @@ -81,7 +81,7 @@ export struct ZhSingleRow02 {
.visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : Visibility.Visible)
.onClick(() => {
if (this.compDTO?.objectType === '11') {
ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string)
ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle)
} else if (this.compDTO?.objectType === '5') {
ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl)
} else if (this.compDTO?.objectType === '6') {
... ...
... ... @@ -40,7 +40,6 @@ export struct ZhSingleRow03 {
// 请求所有预约状态
async getReserveState() {
this.reservedIds = []
const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => {
const reqItem: reserveReqItem = {
liveId: item.objectId.toString(),
... ... @@ -49,6 +48,7 @@ export struct ZhSingleRow03 {
return reqItem;
})
const res = await LiveModel.getAppointmentStatus(reserveBean);
this.reservedIds = []
// this.reserveStatus = res;
Logger.debug(TAG, '数据信息:' + `${JSON.stringify(res)}`)
res.map((item: ReserveItemBean) => {
... ... @@ -280,6 +280,8 @@ struct CreatorItem {
.backgroundColor(0xf5f5f5)
.width(156)
.height(208)
.border({width: 1})
.borderRadius(3)
Row()
.width(156)
.height(80)
... ...
... ... @@ -39,7 +39,7 @@ export struct ZhSingleRow04 {
.visibility(this.compDTO?.objectType === '0' || this.compDTO?.objectType === '' ? Visibility.None : Visibility.Visible)
.onClick(() => {
if (this.compDTO?.objectType === '11') {
ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string)
ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle)
} else if (this.compDTO?.objectType === '5') {
ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl)
} else if (this.compDTO?.objectType === '6') {
... ... @@ -101,7 +101,7 @@ struct localCard {
Text(this.operDataListItem.newsTitle)
.width(CommonConstants.FULL_PARENT)
.height(CommonConstants.FULL_PARENT)
.fontSize($r('app.float.font_size_16'))
.fontSize($r('app.float.font_size_18'))
.fontColor('#000000')
.align(Alignment.TopStart)
.maxLines(3)
... ...
... ... @@ -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')
: $r('app.media.comment_rmh_tag'))
.width(32)
.height(32)
.borderRadius(16)
... ...
import { WDRouterRule, WDRouterPage } from 'wdRouter'
import MinePageDatasModel from '../../model/MinePageDatasModel'
import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem'
import { PagePersonFunction } from './PagePersonFunction'
const TAG = "MinePagePersonFunctionUI"
@Component
export default struct MinePagePersonFunctionUI {
@Link personalData:MinePagePersonalFunctionsItem[]
... ... @@ -62,6 +65,7 @@ export default struct MinePagePersonFunctionUI {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
this.messageClick()
WDRouterRule.jumpWithPage(WDRouterPage.mineMessagePage)
break;
}
... ... @@ -75,5 +79,13 @@ export default struct MinePagePersonFunctionUI {
.height('234lpx')
.margin({top:'31lpx',left:'23lpx',right:'23lpx' })
}
messageClick(){
MinePageDatasModel.sendClickMessageData().then((value) => {
console.log(TAG, "进入消息页面")
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
})
}
}
... ...
import { EmitterUtils, EmitterEventId, Logger } from 'wdKit/Index'
import { EmitterUtils, EmitterEventId, Logger, NetworkUtil } from 'wdKit/Index'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
import { FollowListItem } from '../../../viewmodel/FollowListItem'
import { CustomTitleUI } from '../../reusable/CustomTitleUI'
import { EmptyComponent } from '../../view/EmptyComponent'
import { FollowSecondTabsComponent } from './FollowSecondTabsComponent'
const TAG = "FollowFirstTabsComponent"
@Component
... ... @@ -12,8 +13,19 @@ export struct FollowFirstTabsComponent{
@State data:FollowListItem[] = []
fontColor: string = '#999999'
selectedFontColor: string = '#000000'
@State isConnectNetwork : boolean = NetworkUtil.isNetConnected()
aboutToAppear(){
this.getFollowTabList()
EmitterUtils.receiveEvent(EmitterEventId.MY_FOLLOW_EMPTY, (() => {
if(this.controller != null && this.data.length>1 ){
this.jumpFollowNextPage()
}
}))
}
getFollowTabList(){
MinePageDatasModel.getFollowListData(getContext(this)).then((value)=>{
this.data.push(new FollowListItem("我的"))
value.forEach((element)=>{
... ... @@ -26,12 +38,6 @@ export struct FollowFirstTabsComponent{
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
})
EmitterUtils.receiveEvent(EmitterEventId.MY_FOLLOW_EMPTY, (() => {
if(this.controller != null && this.data.length>1 ){
this.jumpFollowNextPage()
}
}))
}
jumpFollowNextPage(){
... ... @@ -75,6 +81,13 @@ export struct FollowFirstTabsComponent{
//标题栏目
CustomTitleUI({titleName:"关注列表"})
if(!this.isConnectNetwork){
EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => {
this.reloadNetWork()
},})
.layoutWeight(1)
.width('100%')
}else{
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
ForEach(this.data, (item: FollowListItem, index: number ) => {
TabContent(){
... ... @@ -93,6 +106,15 @@ export struct FollowFirstTabsComponent{
})
.width('100%')
.layoutWeight(1)
}
}.width('100%')
}
reloadNetWork(){
let c = NetworkUtil.isNetConnected()
if(c){
this.getFollowTabList()
this.isConnectNetwork = c
}
}
}
\ No newline at end of file
... ...
import { EmitterEventId, EmitterUtils, LazyDataSource, SPHelper, UserDataLocal } from 'wdKit';
import { EmitterEventId, EmitterUtils, LazyDataSource, NetworkUtil, SPHelper, UserDataLocal } from 'wdKit';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel';
import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem';
... ... @@ -70,7 +70,11 @@ export struct FollowListDetailUI {
Column() {
if (this.count === 0) {
if (this.isGetRequest == true) {
if(this.creatorDirectoryId === -1){
if(!NetworkUtil.isNetConnected()){
EmptyComponent({ emptyType: 1,emptyHeight:"100%" })
.layoutWeight(1)
.width('100%')
}else if(this.creatorDirectoryId === -1){
EmptyComponent({ emptyType: 14,emptyHeight:"100%" })
.layoutWeight(1)
.width('100%')
... ...
... ... @@ -7,6 +7,7 @@ import { EmptyComponent } from '../../view/EmptyComponent';
import { ChildCommentComponent } from './ChildCommentComponent';
import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem';
import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
const TAG = "HomePageBottomCommentComponent"
... ... @@ -22,6 +23,7 @@ export struct HomePageBottomCommentComponent {
@State count: number = 0;
@Link commentNum: number
@State isGetRequest: boolean = false
private scroller: Scroller = new Scroller();
aboutToAppear() {
this.getNewPageData()
... ... @@ -42,7 +44,40 @@ export struct HomePageBottomCommentComponent {
.offset({ y: "-200lpx" })
}
} else {
List({ space: 3 }) {
CustomPullToRefresh({
alldata:this.data_comment,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.curPageNum = 1;
this.hasMore = true
this.isGetRequest = false
this.data_comment.clear()
if (!this.isLoading){
this.getNewPageData()
if(resolve) resolve('刷新成功')
}
},
onLoadMore:(resolve)=> {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
}
})
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
.width('100%')
}
@Builder ListLayout(){
List({ space: 3,scroller: this.scroller }) {
LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
ListItem() {
ChildCommentComponent({
... ... @@ -68,18 +103,6 @@ export struct HomePageBottomCommentComponent {
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
.width('100%')
}
getNewPageData() {
... ...
... ... @@ -7,6 +7,7 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { FollowChildComponent } from '../follow/FollowChildComponent';
import dataPreferences from '@ohos.data.preferences';
import { EmptyComponent } from '../../view/EmptyComponent';
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
const TAG = "HomePageBottomFollowComponent"
/**
... ... @@ -14,6 +15,7 @@ const TAG = "HomePageBottomFollowComponent"
*/
@Component
export struct HomePageBottomFollowComponent {
private scroller: Scroller = new Scroller();
@State data_follow: LazyDataSource<FollowListDetailItem> = new LazyDataSource();
@State isLoading: boolean = false
@State hasMore: boolean = true
... ... @@ -104,8 +106,40 @@ export struct HomePageBottomFollowComponent {
})
}.layoutWeight(1)
} else {
List({ space: 3 }) {
CustomPullToRefresh({
alldata:this.data_follow,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.curPageNum = 1;
this.hasMore = true
this.isGetRequest = false
this.data_follow.clear()
if (!this.isLoading){
this.getNewPageData()
if(resolve) resolve('刷新成功')
}
},
onLoadMore:(resolve)=> {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
}
})
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
.width('100%')
}
@Builder ListLayout(){
List({ space: 3 ,scroller:this.scroller}) {
ListItem() {
Row() {
Text("关注更多人民号")
... ... @@ -136,7 +170,6 @@ export struct HomePageBottomFollowComponent {
FollowChildComponent({ data: item, type: 2 })
}
}, (item: FollowListDetailItem, index: number) => index.toString())
//没有更多数据 显示提示
if (!this.hasMore) {
ListItem() {
... ... @@ -153,18 +186,6 @@ export struct HomePageBottomFollowComponent {
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
.width('100%')
}
@Styles
... ...
... ... @@ -7,6 +7,7 @@ import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDet
import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
import { ChildCommentComponent } from './ChildCommentComponent';
import { EmptyComponent } from '../../view/EmptyComponent';
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
const TAG = "HomePageBottomComponent"
/**
... ... @@ -23,6 +24,8 @@ export struct OtherHomePageBottomCommentComponent {
@Prop levelHead: string
@Link commentNum: number
@State isGetRequest: boolean = false
private scroller: Scroller = new Scroller();
aboutToAppear() {
this.getNewPageData()
... ... @@ -41,7 +44,41 @@ export struct OtherHomePageBottomCommentComponent {
.layoutWeight(1)
}
} else {
List({ space: 3 }) {
CustomPullToRefresh({
alldata:this.data_comment,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.curPageNum = 1;
this.hasMore = true
this.isGetRequest = false
this.data_comment.clear()
if (!this.isLoading){
this.getNewPageData()
if(resolve) resolve('刷新成功')
}
},
onLoadMore:(resolve)=> {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
}
})
}
}
.width('100%')
.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}
@Builder ListLayout(){
List({ space: 3 ,scroller: this.scroller}) {
LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
ListItem() {
ChildCommentComponent({
... ... @@ -50,8 +87,6 @@ export struct OtherHomePageBottomCommentComponent {
isLastItem: index === this.data_comment.totalCount() - 1
})
}
.onClick(() => {
})
}, (item: CommentListItem, index: number) => index.toString())
//没有更多数据 显示提示
... ... @@ -69,19 +104,6 @@ export struct OtherHomePageBottomCommentComponent {
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}
.width('100%')
.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}
@Styles
... ...
... ... @@ -4,6 +4,7 @@ import { WDRouterRule, WDRouterPage } from 'wdRouter';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem';
import { UserFollowListRequestItem } from '../../../viewmodel/UserFollowListRequestItem';
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { EmptyComponent } from '../../view/EmptyComponent';
import { FollowChildComponent } from '../follow/FollowChildComponent';
... ... @@ -22,7 +23,7 @@ export struct OtherHomePageBottomFollowComponent{
@State count:number = 0;
@Prop curUserId: string
@State isGetRequest:boolean = false
private scroller: Scroller = new Scroller();
aboutToAppear(){
this.getNewPageData()
... ... @@ -66,8 +67,39 @@ export struct OtherHomePageBottomFollowComponent{
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}else{
List({ space: 3 }) {
CustomPullToRefresh({
alldata:this.data_follow,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.curPageNum = 1;
this.hasMore = true
this.isGetRequest = false
this.data_follow.clear()
if (!this.isLoading){
this.getNewPageData()
if(resolve) resolve('刷新成功')
}
},
onLoadMore:(resolve)=> {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
}
})
}
}
.width('100%')
}
@Builder ListLayout(){
List({ space: 3 ,scroller:this.scroller}) {
ListItem() {
Row(){
Text("关注更多人民号")
... ... @@ -115,19 +147,7 @@ export struct OtherHomePageBottomFollowComponent{
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(()=>{
console.log(TAG,"触底了");
if(!this.isLoading){
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}
.width('100%')
}
@Styles
listStyle() {
... ...
import { StringUtils } from 'wdKit/Index'
import { MessageItem } from '../../../viewmodel/MessageItem'
const TAG = "MessageListUI"
@Component
export struct MessageListItemUI {
@ObjectLink item: MessageItem
@State index:number = -1
build() {
Column(){
Column() {
Row() {
Row() {
Image(this.item.imgSrc)
.objectFit(ImageFit.Auto)
.width('92lpx')
.height('92lpx')
.margin({ right: '15lpx' })
Column() {
Text(this.item.title)
.fontWeight(500)
.fontSize('31lpx')
.lineHeight('42lpx')
.fontColor($r('app.color.color_222222'))
.maxLines(1)
.margin({ bottom: StringUtils.isNotEmpty(this.item.desc)?'8lpx':0 })
if(StringUtils.isNotEmpty(this.item.desc)){
Text(`${this.item.desc}`)
.fontColor($r('app.color.color_999999'))
.fontSize('27lpx')
.lineHeight('38lpx')
.fontWeight(400)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
}
.height('92lpx')
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
.justifyContent(StringUtils.isNotEmpty(this.item.desc)?FlexAlign.Start:FlexAlign.Center)
}.layoutWeight(1)
Column() {
Text(`${this.item.time}`)
.fontColor($r('app.color.color_999999'))
.fontSize('23lpx')
.fontWeight(500)
.lineHeight('35lpx')
.margin({ bottom: this.item.unReadCount > 0 ?'8lpx':0 })
if(this.item.unReadCount > 0){
Button(){
Text(`${this.item.unReadCount}`)
.fontWeight(400)
.fontSize("18lpx")
.fontColor($r('app.color.white'))
}
.type((this.item.unReadCount>0 && this.item.unReadCount < 10 ? ButtonType.Circle:ButtonType.Capsule))
.backgroundColor($r("app.color.color_ED2800"))
.stateEffect(false)
.height("27lpx")
.constraintSize({minWidth:"27lpx"})
}
}
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.End)
.height('92lpx')
}
.width('100%')
.height('92lpx')
.justifyContent(FlexAlign.SpaceBetween)
}.height('154lpx')
.width("100%")
.justifyContent(FlexAlign.Center)
Text().backgroundColor($r('app.color.color_EDEDED'))
.width('100%')
.height('1lpx')
.visibility(this.index != 3 ?Visibility.Visible:Visibility.None)
}
}
}
\ No newline at end of file
... ...