王士厅

解决冲突

Showing 78 changed files with 2190 additions and 584 deletions

Too many changes to show.

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

... ... @@ -47,4 +47,5 @@ export class SpConstants{
//游客状态下首次评论时间
static FIRSTCOMMENTTIME = 'firstCommentTime'
static TOURIST_NICK_NAME = 'touristNickName'
}
\ No newline at end of file
... ...
... ... @@ -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'
... ... @@ -61,3 +63,5 @@ export { MpaasUtils } from './src/main/ets/mpaas/MpaasUtils'
export { MpaasUpgradeCheck, UpgradeTipContent } from './src/main/ets/mpaas/MpaasUpgradeCheck'
export { TingyunAPM } from './src/main/ets/tingyunAPM/TingyunAPM'
export { FastClickUtil } from './src/main/ets/utils/FastClickUtil';
\ No newline at end of file
... ...
@CustomDialog
export struct CustomToast {
public static LENGTH_LONG = 5000;
public static LENGTH_SHORT = 3000;
public static LENGTH_LONG = 4000;
public static LENGTH_SHORT = 2000;
@State msg: string = ""
@State duration: number = CustomToast.LENGTH_SHORT
... ... @@ -29,6 +29,7 @@ export struct CustomToast {
.fontColor($r('app.color.white'))
.fontSize("27lpx")
.lineHeight("38lpx")
.textAlign(TextAlign.Center)
}.borderRadius(`${this.bgBorderRadius}lpx`)
.constraintSize({maxWidth:"86%"})
.padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"})
... ...
... ... @@ -26,6 +26,9 @@ export enum EmitterEventId {
// 换绑成功
PHONE_CHANGE_SUCCESS = 9,
// 直播间-取消-预约成功
LIVE_ROOM_SUBSCRIBE = 10,
// App回到前台
APP_ENTER_FOREGROUD = 100,
// App进入后台
... ...
import systemDateTime from '@ohos.systemDateTime';
/**
* 屏蔽快速点击事件,规定时间内只触发一次
*/
export class FastClickUtil {
static MIN_DELAY_TIME = 500
static minDelayBeforeTime = 0
static async isMinDelayTime(): Promise<boolean> {
let systime = await systemDateTime.getCurrentTime();
return new Promise<boolean>((success, error) => {
let rtnvalue = systime - FastClickUtil.minDelayBeforeTime <= FastClickUtil.MIN_DELAY_TIME;
this.minDelayBeforeTime = systime;
success(rtnvalue);
})
}
}
... ...
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
... ...
... ... @@ -4,7 +4,7 @@ import { Logger } from './Logger';
const TAG = 'SPHelper'
/**
* sp存储
* sp存储,单条数据,value<1k;业务数据超过1k的,建议使用KVStoreHelper
*/
export class SPHelper {
private static context: Context;
... ...
... ... @@ -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"
... ...
... ... @@ -135,6 +135,14 @@ export class HttpUrlUtils {
*/
static readonly APPOINTMENT_ExecuteCollcet_PATH: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord";
/**
* 个人中心 - 消息
*/
static readonly APPOINTMENT_MessageList_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private";
/**
* 个人中心 - 消息 点赞数
*/
static readonly APPOINTMENT_getMessageLikeCount_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/getLikeCount";
/**
* 个人中心 我的评论列表
*/
static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList";
... ... @@ -213,7 +221,7 @@ export class HttpUrlUtils {
/**
* 预约状态
*/
static readonly LIVE_APPOINTMENT_BATCH_PATH: string = "api/live-center-message/zh/c/live/subscribe/user/batch";
static readonly LIVE_APPOINTMENT_BATCH_PATH: string = "/api/live-center-message/zh/c/live/subscribe/user/batch";
/**
* 搜索结果 显示tab 数
... ... @@ -301,6 +309,45 @@ export class HttpUrlUtils {
* 查询是否设置过密码checkSetPassword
*/
static readonly CHECK_SET_PASSWORD_PATH: string = "/api/rmrb-user-center/user/zh/c/ifSetPassword";
/**
* 获取oss 配置
*/
static readonly OSS_PARAMS_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/oss/configs";
/**
* 获取上传OSS token
*/
static readonly STS_TOKEN_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/oss/stsToken";
/**
* 获取意见反馈类型
*/
static readonly FEEDBACK_TYPE_PATH: string = "/api/rmrb-interact/interact/c/user/optionClassify/list";
/**
* 查询点赞、回复我的、系统消息的未读数量以及回复/评论人
*/
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 getHost(): string {
return HostManager.getHost();
... ... @@ -463,6 +510,16 @@ export class HttpUrlUtils {
return url
}
static getMessageListDataUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_MessageList_PATH
return url
}
static getMessageLikeCount() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_getMessageLikeCount_PATH
return url
}
static getExecuteCollcetUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH
return url
... ... @@ -699,4 +756,39 @@ export class HttpUrlUtils {
return url;
}
//获取消息未读接口
static getMessageUnReadDataUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.MESSAGE_UN_READ_DATA_PATH
return url
}
static reportDeviceInfo() {
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
... ...
... ... @@ -92,6 +92,8 @@ export function registerRouter() {
return WDRouterPage.liveMorePage
} else if (action.params?.pageID == "ORDER_MORE_PAGE") {
return WDRouterPage.reserveMorePage
} else if (action.params?.pageID == "FeedBackActivity") {
return WDRouterPage.feedBackActivity
}
return undefined
})
... ...
... ... @@ -83,6 +83,9 @@ export class WDRouterPage {
static browsingHistoryPage = new WDRouterPage("wdComponent", "ets/components/page/BrowsingHistoryPage");
//我的收藏
static myCollectionListPagePage = new WDRouterPage("wdComponent", "ets/components/page/MyCollectionListPage");
//互动消息
static interactMessagePage = new WDRouterPage("wdComponent", "ets/components/page/InteractMessagePage");
static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview");
//我的主页
static mineHomePage = new WDRouterPage("wdComponent", "ets/pages/MineHomePage");
... ... @@ -116,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");
//人民号主页
... ... @@ -123,11 +128,19 @@ export class WDRouterPage {
//直播更多页
static liveMorePage = new WDRouterPage("wdComponent", "ets/components/page/LiveMorePage");
//预约更多页
static reserveMorePage = new WDRouterPage("wdComponent", "ets/components/page/ReserveMorePage");
static reserveMorePage = new WDRouterPage("wdComponent", "ets/components/reserveMore/ReserveMorePage");
//金刚位聚合页
static themeListPage = new WDRouterPage("wdComponent", "ets/components/page/ThemeListPage");
// 栏目页面、频道详情
static columnPage = new WDRouterPage("phone", "ets/pages/column/ColumnPage");
//展示头像
static showUserHeaderPage = new WDRouterPage("wdComponent", "ets/pages/ShowUserHeaderPage");
//意见反馈
static feedBackActivity = new WDRouterPage("wdComponent", "ets/components/FeedBackActivity");
// 人民号主页头像显示
static showHomePageHeaderPage = new WDRouterPage("wdComponent", "ets/pages/ShowHomePageHeaderPage");
}
... ...
... ... @@ -108,7 +108,11 @@ export class ProcessUtils {
break;
case ContentConstants.TYPE_TELETEXT:
// 图文详情,跳转h5
if(content?.linkUrl){ //有 linkUrl 走专题页展示逻辑
ProcessUtils.gotoSpecialTopic(content)
}else{
ProcessUtils.gotoWeb(content);
}
break;
case ContentConstants.TYPE_LINK:
ProcessUtils.gotoDefaultWeb(content);
... ... @@ -441,4 +445,26 @@ export class ProcessUtils {
let params = { 'creatorId': creatorId } as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
/**
* 意见反馈
*/
public static gotoFeedBackActivity() {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
pageID: 'FeedBackActivity'
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
}
/**
* 跳转到登录页
*/
public static gotoLoginPage() {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
}
}
... ...
... ... @@ -39,14 +39,14 @@ class AppLoginAuthInfo {
}
interface IDataJson {
jumpType:number
jumpUrl:string
newsId:string
newsObjectLevel:string
newsObjectType:number
newsRelId:string
newsTitle:string
pageId:string
jumpType: number
jumpUrl: string
newsId: string
newsObjectLevel: string
newsObjectType: number
newsRelId: string
newsTitle: string
pageId: string
}
/**
... ... @@ -209,6 +209,11 @@ function handleJsCallAppInnerLinkMethod(data: Message) {
let creatorId = urlParams.get('creatorId') || ''
ProcessUtils.gotoPeopleShipHomePage(creatorId)
break;
case 'app':
if (urlParams.get('subType') === 'login') {
ProcessUtils.gotoLoginPage()
}
break;
default:
break;
}
... ...
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
import { H5ReceiveDataJsonBean, postBatchAttentionStatusResult } from 'wdBean';
import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork';
import { WDHttp, HttpUrlUtils } from 'wdNetwork';
const TAG = 'JsCallAppService'
export function handleJsCallAppService(data: Message, callback: (res: string) => void) {
let url: string = HttpUrlUtils.getHost() + data?.data?.url
let responseMap: ResponseDTO<postBatchAttentionStatusResult> = {} as ResponseDTO<postBatchAttentionStatusResult>
if (data?.data?.method === 'get') {
let queryString: string = ''
let parameters = data?.data?.parameters
if (parameters) {
queryString = Object.keys(parameters)
.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(parameters?.[key])}`)
.join('&');
}
let h5ReceiveDataJson: H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>> = {
let url: string = HttpUrlUtils.getHost() + data?.data?.url
if (queryString) {
url = url + `?${queryString}`
}
console.log('yzl', queryString, url)
WDHttp.get(url).then((res) => {
callback(JSON.stringify({
netError: '0',
responseMap
} as H5ReceiveDataJsonBean<ResponseDTO<postBatchAttentionStatusResult>>
responseMap: res
}))
})
}
if (data?.data?.method === 'post') {
let url: string = HttpUrlUtils.getHost() + data?.data?.url
// if (data?.data?.method === 'get') {
// WDHttp.get<ResponseDTO<postBatchAttentionStatusResult>>(url, headers).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
// callback(JSON.stringify(res))
// })
// }
if (data?.data?.method === 'post' && data?.data?.url === '/api/rmrb-interact/interact/zh/c/batchAttention/status') {
WDHttp.post<ResponseDTO<postBatchAttentionStatusResult>>(url, data?.data?.parameters).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
h5ReceiveDataJson.responseMap = res
callback(JSON.stringify(h5ReceiveDataJson))
WDHttp.post(url, data?.data?.parameters).then((res) => {
callback(JSON.stringify({
netError: '0',
responseMap: res
}))
})
}
}
... ...
... ... @@ -55,7 +55,7 @@ export struct WdWebLocalComponent {
.mixedMode(MixedMode.All)
.onlineImageAccess(true)
.enableNativeEmbedMode(true)
.layoutMode(WebLayoutMode.FIT_CONTENT)
// .layoutMode(WebLayoutMode.FIT_CONTENT)
// .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST })
.height(this.webHeight)
.onPageBegin((event) => {
... ...
... ... @@ -169,3 +169,9 @@ export { ClassBean } from './src/main/ets/bean/content/ClassBean';
export { CreatorsBean } from './src/main/ets/bean/content/CreatorsBean';
export { MasterDetailRes } from './src/main/ets/bean/user/MasterDetailRes';
export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean';
export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean';
\ No newline at end of file
... ...
... ... @@ -84,7 +84,7 @@ export class ContentDTO implements BaseDTO {
openType: string = '';
extra: string = ''
static clone(old:ContentDTO): ContentDTO {
static clone(old: ContentDTO): ContentDTO {
let content = new ContentDTO();
content.appStyle = old.appStyle;
content.cityCode = old.cityCode;
... ...
export interface commentInfo {
commentTitle: string,
newsTitle: string,
userName: string,
userHeaderUrl: string,
userId?: string,
userName?: string,
userHeaderUrl?: string,
publishTime: number,
commentId: string,
newsId: string,
relId: string;
relType: string;
userId: string;
newsType?: string,
objectType?: string,
}
\ No newline at end of file
... ...
export interface FeedbackTypeBean {
classifyName: string;
id: number;
isselect: boolean;
}
\ No newline at end of file
... ...
@Observed export class ReserveItemBean {
liveId: number
relationId: string
subscribe: boolean
constructor( liveId: number, relationId: string, subscribe: boolean) {
this.liveId = liveId;
this.relationId = relationId;
this.subscribe = subscribe;
}
}
... ...
... ... @@ -57,6 +57,8 @@ export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailCompo
export { DynamicDetailComponent } from "./src/main/ets/components/DynamicDetailComponent"
export { FeedBackActivity } from "./src/main/ets/components/FeedBackActivity"
export { AudioSuspensionModel } from "./src/main/ets/viewmodel/AudioSuspensionModel"
export { BroadcastPageComponent } from "./src/main/ets/components/broadcast/BroadcastPageComponent"
... ... @@ -65,7 +67,7 @@ export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/Fir
export { ListHasNoMoreDataUI } from "./src/main/ets/components/reusable/ListHasNoMoreDataUI"
export { LottieView } from './src/main/ets/lottie/LottieView'
export { LottieView } from './src/main/ets/components/lottie/LottieView'
export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopicPageComponent'
... ...
... ... @@ -7,7 +7,7 @@
"main": "Index.ets",
"version": "1.0.0",
"dependencies": {
"@ohos/lottie": "2.0.0",
"@ohos/lottie": "2.0.10",
"wdConstant": "file:../../commons/wdConstant",
"wdPlayer": "file:../../features/wdPlayer",
"wdLogin": "file:../../features/wdLogin",
... ...
import { CommonConstants, CompStyle } from 'wdConstant';
import { ContentDTO } from 'wdBean';
import { CompStyle } from 'wdConstant';
import { CompDTO, ContentDTO } from 'wdBean';
import { Card2Component } from './cardview/Card2Component';
import { Card3Component } from './cardview/Card3Component';
import { Card4Component } from './cardview/Card4Component';
... ... @@ -24,13 +24,14 @@ import { Card21Component } from './cardview/Card21Component';
@Component
export struct CardParser {
@State contentDTO: ContentDTO = new ContentDTO();
@State compDTO: CompDTO = {} as CompDTO
build() {
this.contentBuilder(this.contentDTO);
this.contentBuilder(this.contentDTO, this.compDTO);
}
@Builder
contentBuilder(contentDTO: ContentDTO) {
contentBuilder(contentDTO: ContentDTO, compDTO: CompDTO) {
if (contentDTO.appStyle === CompStyle.Card_02) {
Card2Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_03) {
... ... @@ -38,7 +39,7 @@ export struct CardParser {
} else if (contentDTO.appStyle === CompStyle.Card_04) {
Card4Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_05) {
Card5Component({ contentDTO })
Card5Component({ contentDTO, titleShowPolicy: compDTO.titleShowPolicy })
} else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle
.Card_13) {
Card6Component({ contentDTO })
... ... @@ -64,8 +65,7 @@ export struct CardParser {
Card20Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_21) {
Card21Component({ contentDTO })
}
else {
} else {
// todo:组件未实现 / Component Not Implemented
// Text(contentDTO.appStyle)
// .width(CommonConstants.FULL_PARENT)
... ...
import { SPHelper,Logger,ToastUtils } from 'wdKit';
import { ContentDetailDTO, Action, ContentDTO,batchLikeAndCollectResult } from 'wdBean';
import { SPHelper, Logger, ToastUtils } from 'wdKit';
import { ContentDetailDTO, Action, ContentDTO, batchLikeAndCollectResult } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import router from '@ohos.router';
import { batchLikeAndCollectParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { SpConstants } from 'wdConstant/Index';
import { WDShare } from 'wdShare/Index';
import {LikeComponent} from './view/LikeComponent'
import { LikeComponent } from './view/LikeComponent'
const TAG = 'CarderInteraction'
/**
* 卡片 分享、评论、点赞公用组件
*/
... ... @@ -15,9 +17,10 @@ const TAG = 'CarderInteraction'
export struct CarderInteraction {
@Prop contentDTO: ContentDTO
@State contentId: string = ''
@State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult // 点赞、收藏状态
@State likeBean: Record<string, string> = {}
async aboutToAppear() {
await this.getContentDetailData()
// 点赞需要数据
... ... @@ -28,51 +31,55 @@ export struct CarderInteraction {
this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + ''
this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
}
build() {
Row(){
Row(){
Row() {
Row() {
Image($r('app.media.CarderInteraction_share'))
.width(18)
.height(18)
Text('分享')
.margin({left:4})
.margin({ left: 4 })
.fontSize(14)
.fontColor('#666666')
}
.justifyContent(FlexAlign.Center)
.onClick(()=>{
.onClick(() => {
WDShare.shareContent(this.contentDetailData)
})
Row(){
Row() {
Image($r('app.media.CarderInteraction_comment'))
.width(18)
.height(18)
Text('评论')
.margin({left:4})
.margin({ left: 4 })
.fontSize(14)
.fontColor('#666666')
}
.justifyContent(FlexAlign.Center)
.onClick(()=>{
.onClick(() => {
ProcessUtils.processPage(this.contentDTO)
})
this.builderLike()
}
.width('100%')
.margin({top:11})
.margin({ top: 11 })
.padding({
left:21,
right:21
left: 21,
right: 21
})
.justifyContent(FlexAlign.SpaceBetween)
.alignItems(VerticalAlign.Center)
}
/**
* 点赞组件
*/
@Builder
builderLike() {
Row(){
Row() {
if (this.likeBean?.contentId) {
LikeComponent({
data: this.likeBean,
... ... @@ -88,13 +95,13 @@ export struct CarderInteraction {
* */
private async getContentDetailData() {
try {
let data = await MultiPictureDetailViewModel.getDetailData(this.contentDTO.relId, this.contentDTO.objectId, this.contentDTO.relType)
let data = await MultiPictureDetailViewModel.getDetailData(this.contentDTO.relId, this.contentDTO.objectId,
this.contentDTO.relType)
this.contentDetailData = data[0];
console.log('动态详情',JSON.stringify(this.contentDetailData))
console.log('动态详情', JSON.stringify(this.contentDetailData))
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
console.log('请求失败', JSON.stringify(exception))
}
}
}
... ...
... ... @@ -14,7 +14,6 @@ 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';
... ... @@ -23,6 +22,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { AdvCardParser } from './cardViewAdv/AdvCardParser';
import PageModel from '../viewmodel/PageModel';
import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent';
import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01';
/**
* comp适配器.
... ... @@ -32,12 +32,12 @@ import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'
@Component
export struct CompParser {
@State compDTO: CompDTO = {} as CompDTO
@State private pageModel: PageModel = new PageModel();
@State compIndex: number = 0;
@State private pageModel: PageModel = new PageModel();
build() {
Column() {
if (this.compDTO.name !="月度排行卡") {
if (this.compDTO.name != "月度排行卡") {
this.componentBuilder(this.compDTO, this.compIndex);
}
... ... @@ -53,7 +53,8 @@ export struct CompParser {
} else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
ZhCarouselLayout01({ compDTO: 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 (compDTO.compStyle === CompStyle.Zh_Single_Row_01 &&
compDTO.imageScale === 2) { // && compDTO.name ==="横划卡"
LiveHorizontalCardComponent({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
... ... @@ -87,7 +88,7 @@ export struct CompParser {
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
//头图卡 和comStyle 2相同,
Card5Component({ contentDTO: compDTO.operDataList[0] })
Card5Component({ contentDTO: compDTO.operDataList[0], titleShowPolicy: compDTO.titleShowPolicy })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) {
// 大图卡
... ... @@ -107,10 +108,9 @@ export struct CompParser {
//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] });
CardParser({ contentDTO: compDTO.operDataList[0], compDTO });
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
}
else {
} else {
Text(compDTO.compStyle)
.width(CommonConstants.FULL_PARENT)
.padding(10)
... ...
import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper, NumberFormatterUtils, DisplayUtils,
NetworkUtil } from 'wdKit';
import {
AccountManagerUtils,
Logger,
DateTimeUtils,
SPHelper,
NumberFormatterUtils,
DisplayUtils,
NetworkUtil,
FastClickUtil
} from 'wdKit';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { ContentDetailDTO,postBatchAttentionStatusParams,
import {
ContentDetailDTO,
postBatchAttentionStatusParams,
PhotoListBean,
ContentDTO,
batchLikeAndCollectResult,
RmhInfoDTO,
InteractDataDTO, } from 'wdBean';
InteractDataDTO,
} from 'wdBean';
import media from '@ohos.multimedia.media';
import { OperRowListView } from './view/OperRowListView';
import { WDPlayerController } from 'wdPlayer/Index';
... ... @@ -33,6 +44,7 @@ import { detailedSkeleton } from './skeleton/detailSkeleton';
const TAG = 'DynamicDetailComponent'
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
// @Preview
@Component
export struct DynamicDetailComponent {
... ... @@ -40,39 +52,35 @@ export struct DynamicDetailComponent {
private relId: string = ''
private contentId: string = ''
private relType: string = ''
//出参
@State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
//UI
scroller: Scroller = new Scroller();
//点赞 收藏 评论 数量
@State interactDataDTO: InteractDataDTO = {likeNum:0} as InteractDataDTO
@State interactDataDTO: InteractDataDTO = { likeNum: 0 } as InteractDataDTO
/**
* 关注状态:默认未关注 点击去关注
*/
@State followStatus: String = '';
@State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态
@State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult // 点赞、收藏状态
//跳转
private mJumpInfo: ContentDTO = new ContentDTO();
@State publishTime: string = ''
@State isNetConnected: boolean = true
@State isPageEnd: boolean = false
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State reachEndIncreament: number = 0
async aboutToAppear() {
await this.getContentDetailData()
}
onPageHide() {
}
build() {
Column(){
Column() {
//logo、日期
Row() {
Image($r('app.media.ic_article_rmh'))
... ... @@ -89,12 +97,13 @@ export struct DynamicDetailComponent {
.height($r('app.float.margin_48'))
.width('100%')
.alignItems(VerticalAlign.Bottom)
.padding({bottom:5})
.padding({ bottom: 5 })
//分割线
Image($r('app.media.ic_news_detail_division'))
.width('100%')
.height($r('app.float.margin_7'))
.padding({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} )
.padding({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') })
Stack({ alignContent: Alignment.Bottom }) {
if (!this.isNetConnected) {
EmptyComponent({
... ... @@ -107,7 +116,7 @@ export struct DynamicDetailComponent {
} else {
if (!this.isPageEnd) {
detailedSkeleton()
}else{
} else {
Scroll(this.scroller) {
Column() {
//号主信息
... ... @@ -115,7 +124,8 @@ export struct DynamicDetailComponent {
//头像
Stack() {
Image(this.contentDetailData.rmhInfo?.rmhHeadUrl)
.alt(this.contentDetailData.rmhInfo?.userType=='1'?$r('app.media.default_head'):$r('app.media.icon_default_head_mater'))
.alt(this.contentDetailData.rmhInfo?.userType == '1' ? $r('app.media.default_head') :
$r('app.media.icon_default_head_mater'))
.width($r('app.float.margin_32'))
.height($r('app.float.margin_32'))
.objectFit(ImageFit.Cover)
... ... @@ -125,7 +135,7 @@ export struct DynamicDetailComponent {
.height($r('app.float.margin_48'))
.objectFit(ImageFit.Cover)
.borderRadius($r('app.float.margin_24'))
if(!StringUtils.isEmpty(this.contentDetailData.rmhInfo?.authIcon)){
if (!StringUtils.isEmpty(this.contentDetailData.rmhInfo?.authIcon)) {
Stack() {
Image(this.contentDetailData.rmhInfo?.authIcon)
.width($r('app.float.vp_12'))
... ... @@ -140,10 +150,16 @@ export struct DynamicDetailComponent {
.width($r('app.float.margin_48'))
.height($r('app.float.margin_48'))
.alignContent(Alignment.Center)
.onClick(() => {
ProcessUtils.gotoPeopleShipHomePage(this.contentDetailData.rmhInfo == null ?"":this.contentDetailData.rmhInfo.rmhId)
.onClick(async () => {
let retvalue = await FastClickUtil.isMinDelayTime()
if(retvalue){
return
}
ProcessUtils.gotoPeopleShipHomePage(this.contentDetailData.rmhInfo == null ? "" :
this.contentDetailData.rmhInfo.rmhId)
})
Column(){
Column() {
//昵称
Text(this.contentDetailData.rmhInfo?.rmhName)
.fontSize($r('app.float.font_size_14'))
... ... @@ -162,15 +178,16 @@ export struct DynamicDetailComponent {
.alignSelf(ItemAlign.Start)
}
.width('63%')
.margin({right: $r('app.float.margin_6')})
if(!StringUtils.isEmpty(this.followStatus)){
.margin({ right: $r('app.float.margin_6') })
if (!StringUtils.isEmpty(this.followStatus)) {
if (this.followStatus == '0') {
Row() {
Blank().layoutWeight(1)
Image($r('app.media.icon_add_attention'))
.width($r('app.float.vp_12'))
.height($r('app.float.vp_12'))
.margin({right:2})
.margin({ right: 2 })
Text('关注')
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
... ... @@ -181,7 +198,11 @@ export struct DynamicDetailComponent {
.height($r('app.float.margin_24'))
.borderRadius($r('app.float.vp_3'))
.backgroundColor($r('app.color.color_ED2800'))
.onClick(() => {
.onClick(async () => {
let retvalue = await FastClickUtil.isMinDelayTime()
if(retvalue){
return
}
this.handleAccention()
})
} else {
... ... @@ -195,30 +216,37 @@ export struct DynamicDetailComponent {
.borderColor($r('app.color.color_CCCCCC_1A'))
.backgroundColor($r('app.color.color_CCCCCC_1A'))
.fontColor($r('app.color.color_CCCCCC'))
.onClick(() => {
.onClick(async () => {
let retvalue = await FastClickUtil.isMinDelayTime()
if(retvalue){
return
}
this.handleAccention()
})
}
}
}
.width('100%')
.margin({ left: $r('app.float.margin_16')})
.margin({ left: $r('app.float.margin_16') })
//内容
Text(StringUtils.isEmpty(this.contentDetailData.newsContent)
?StringUtils.isEmpty(this.contentDetailData.newsSummary)
?this.contentDetailData.newsTitle
:this.contentDetailData.newsSummary
:this.contentDetailData.newsContent)
? StringUtils.isEmpty(this.contentDetailData.newsSummary)
? this.contentDetailData.newsTitle
: this.contentDetailData.newsSummary
: this.contentDetailData.newsContent)
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_18'))
.lineHeight($r('app.float.margin_25'))
.margin({ top: $r('app.float.margin_6')
,left: $r('app.float.margin_16')
,right: $r('app.float.margin_16') })
.margin({
top: $r('app.float.margin_6')
, left: $r('app.float.margin_16')
, right: $r('app.float.margin_16')
})
.alignSelf(ItemAlign.Start)
if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){
if (this.contentDetailData.newsType + "" == ContentConstants.TYPE_FOURTEEN) {
//附件内容:图片/视频
if(this.contentDetailData.photoList!= null && this.contentDetailData.photoList.length>0){
if (this.contentDetailData.photoList != null && this.contentDetailData.photoList.length > 0) {
// 图片-从无图到9图展示
GridRow({
gutter: { x: 2, y: 2 }
... ... @@ -228,7 +256,7 @@ export struct DynamicDetailComponent {
if (this.getPicType(item) !== 3) {
GridCol({
span: this.getPicType(item) === 1 ? 12 : 8
}){
}) {
Stack({
alignContent: Alignment.BottomEnd
}) {
... ... @@ -249,7 +277,7 @@ export struct DynamicDetailComponent {
Image($r('app.media.icon_long_pic'))
.width(14)
.height(14)
.margin({right: 4})
.margin({ right: 4 })
Text('长图')
.fontSize(12)
.fontWeight(400)
... ... @@ -257,12 +285,16 @@ export struct DynamicDetailComponent {
.fontFamily('PingFang SC')
}
.width(48)
.padding({bottom: 9})
.padding({ bottom: 9 })
}
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
.onClick(async (event: ClickEvent) => {
let retvalue = await FastClickUtil.isMinDelayTime()
if(retvalue){
return
}
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
})
} else {
GridCol({
... ... @@ -278,8 +310,12 @@ export struct DynamicDetailComponent {
item.height = callback?.height || 0;
})
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
.onClick(async (event: ClickEvent) => {
let retvalue = await FastClickUtil.isMinDelayTime()
if(retvalue){
return
}
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
})
}
} else if (this.contentDetailData.photoList.length === 4) {
... ... @@ -290,8 +326,12 @@ export struct DynamicDetailComponent {
.aspectRatio(1)
.borderRadius(this.caclImageRadius(index))
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
.onClick(async (event: ClickEvent) => {
let retvalue = await FastClickUtil.isMinDelayTime()
if(retvalue){
return
}
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
})
} else {
GridCol({
... ... @@ -301,16 +341,24 @@ export struct DynamicDetailComponent {
.aspectRatio(1)
.borderRadius(this.caclImageRadius(index))
}
.onClick((event: ClickEvent) => {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList,index)
.onClick(async (event: ClickEvent) => {
let retvalue = await FastClickUtil.isMinDelayTime()
if(retvalue){
return
}
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
})
}
})
}
.margin({ left: $r('app.float.margin_16'),right: $r('app.float.margin_16'),top: $r('app.float.margin_8')})
.margin({
left: $r('app.float.margin_16'),
right: $r('app.float.margin_16'),
top: $r('app.float.margin_8')
})
}
}else{
if(this.contentDetailData.videoInfo!= null && this.contentDetailData.videoInfo.length>0){
} else {
if (this.contentDetailData.videoInfo != null && this.contentDetailData.videoInfo.length > 0) {
GridRow() {
if (this.contentDetailData.videoInfo[0].videoLandScape === 1) {
// 横屏
... ... @@ -318,11 +366,13 @@ export struct DynamicDetailComponent {
span: { xs: 12 }
}) {
Stack() {
Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)?
this.contentDetailData.fullColumnImgUrls[0].url:
Image(this.contentDetailData.fullColumnImgUrls != null &&
this.contentDetailData.fullColumnImgUrls.length > 0 &&
!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url) ?
this.contentDetailData.fullColumnImgUrls[0].url :
this.contentDetailData.videoInfo[0].firstFrameImageUri)
.width(DisplayUtils.getDeviceWidth()- 32)
.height((DisplayUtils.getDeviceWidth()-32)* 9 / 16)
.width(DisplayUtils.getDeviceWidth() - 32)
.height((DisplayUtils.getDeviceWidth() - 32) * 9 / 16)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.mJumpInfo })
}
... ... @@ -334,11 +384,13 @@ export struct DynamicDetailComponent {
span: { xs: 6 }
}) {
Stack() {
Image(this.contentDetailData.fullColumnImgUrls!= null && this.contentDetailData.fullColumnImgUrls.length>0&&!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url)?
this.contentDetailData.fullColumnImgUrls[0].url:
Image(this.contentDetailData.fullColumnImgUrls != null &&
this.contentDetailData.fullColumnImgUrls.length > 0 &&
!StringUtils.isEmpty(this.contentDetailData.fullColumnImgUrls[0].url) ?
this.contentDetailData.fullColumnImgUrls[0].url :
this.contentDetailData.videoInfo[0].firstFrameImageUri)
.width(DisplayUtils.getDeviceWidth()/2)
.height(DisplayUtils.getDeviceWidth()/2* 4 / 3)
.width(DisplayUtils.getDeviceWidth() / 2)
.height(DisplayUtils.getDeviceWidth() / 2 * 4 / 3)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.mJumpInfo })
}
... ... @@ -346,8 +398,15 @@ export struct DynamicDetailComponent {
}
}
}
.padding({ left: this.contentDetailData.videoInfo[0].videoLandScape === 1?0: 25,top: $r('app.float.margin_8')})
.onClick((event: ClickEvent) => {
.padding({
left: this.contentDetailData.videoInfo[0].videoLandScape === 1 ? 0 : 25,
top: $r('app.float.margin_8')
})
.onClick(async (event: ClickEvent) => {
let retvalue = await FastClickUtil.isMinDelayTime()
if(retvalue){
return
}
ProcessUtils.processPage(this.mJumpInfo)
})
}
... ... @@ -357,9 +416,11 @@ export struct DynamicDetailComponent {
.fontColor($r('app.color.color_CCCCCC'))
.fontSize($r('app.float.font_size_12'))
.lineHeight($r('app.float.margin_16'))
.margin({ top: $r('app.float.margin_16')
,left: $r('app.float.vp_12')
,right: $r('app.float.vp_12') })
.margin({
top: $r('app.float.margin_16')
, left: $r('app.float.vp_12')
, right: $r('app.float.vp_12')
})
//微信/朋友圈/微博
// Row(){
// Image($r('app.media.xxhdpi_pic_wechat'))
... ... @@ -379,37 +440,42 @@ export struct DynamicDetailComponent {
// }
// .margin({ top: $r('app.float.margin_24')})
//点赞
Row(){
Row() {
Blank().layoutWeight(1)
Image(this.newsStatusOfUser?.likeStatus == '1'?
Image(this.newsStatusOfUser?.likeStatus == '1' ?
$r('app.media.icon_like_selected_redheart')
:$r('app.media.icon_like_unselect_grey_redheart'))
: $r('app.media.icon_like_unselect_grey_redheart'))
.width($r('app.float.margin_36'))
.height($r('app.float.margin_36'))
.objectFit(ImageFit.Cover)
.margin({ left: $r('app.float.margin_6_negative'),right: $r('app.float.margin_6_negative')})
if(this.interactDataDTO?.likeNum != 0){
.margin({ left: $r('app.float.margin_6_negative'), right: $r('app.float.margin_6_negative') })
if (this.interactDataDTO?.likeNum != 0) {
Text(NumberFormatterUtils.formatNumberWithWan(this.interactDataDTO?.likeNum))
.fontColor($r('app.color.color_999999'))
.fontSize($r('app.float.font_size_16'))
.lineHeight($r('app.float.margin_20'))
.margin({ left: $r('app.float.margin_2')})
.margin({ left: $r('app.float.margin_2') })
}
Blank().layoutWeight(1)
}
.width($r('app.float.margin_154'))
.height($r('app.float.margin_40'))
.margin({top:$r('app.float.margin_16')})
.margin({ top: $r('app.float.margin_16') })
.borderWidth($r('app.float.margin_1'))
.borderColor($r('app.color.color_EDEDED'))
.borderRadius($r('app.float.margin_20'))
.onClick((event: ClickEvent) => {
.onClick(async (event: ClickEvent) => {
let retvalue = await FastClickUtil.isMinDelayTime()
if(retvalue){
return
}
//点赞操作
this.toggleLikeStatus()
})
// 评论
if (this.contentDetailData?.openComment) {
Divider().strokeWidth(6).color('#f5f5f5').margin({top:$r('app.float.margin_24')})
Divider().strokeWidth(6).color('#f5f5f5').margin({ top: $r('app.float.margin_24') })
CommentComponent({
publishCommentModel: {
targetId: String(this.contentDetailData?.newsId || ''),
... ... @@ -447,11 +513,19 @@ export struct DynamicDetailComponent {
.width('100%')
.height('100%')
}
/**
* 请求(动态)详情页数据
* */
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;
... ... @@ -460,9 +534,9 @@ export struct DynamicDetailComponent {
DateTimeUtils.parseDate(this.contentDetailData?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime)
console.log('动态详情',JSON.stringify(this.contentDetailData))
console.log('动态详情', JSON.stringify(this.contentDetailData))
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
console.log('请求失败', JSON.stringify(exception))
this.isPageEnd = true;
}
this.getBatchAttentionStatus()
... ... @@ -471,10 +545,11 @@ export struct DynamicDetailComponent {
this.interactDataV2()
}
private async interactDataV2() {
this.interactDataDTO = await MultiPictureDetailViewModel.interactDataV2(
this.contentDetailData?.newsId+'',this.contentDetailData?.newsType+'',this.contentDetailData.reLInfo == null ?'':this.contentDetailData.reLInfo?.relId,this.contentDetailData.rmhPlatform)
this.contentDetailData?.newsId + '', this.contentDetailData?.newsType + '',
this.contentDetailData.reLInfo == null ? '' : this.contentDetailData.reLInfo?.relId,
this.contentDetailData.rmhPlatform)
}
// 已登录->查询用户对作品点赞、收藏状态
... ... @@ -526,18 +601,19 @@ export struct DynamicDetailComponent {
}
//创建跳转信息
makeJumpInfo(){
makeJumpInfo() {
this.mJumpInfo.pageId = 'dynamicDetailPage'
this.mJumpInfo.objectId = this.contentDetailData.newsId+""
this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType+""
this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId+""
this.mJumpInfo.objectType = (this.contentDetailData.newsType+"") == ContentConstants.TYPE_FOURTEEN?this.contentDetailData.newsType+"":ContentConstants.TYPE_VOD
if(this.contentDetailData.videoInfo!= null && this.contentDetailData.videoInfo.length>0){
this.mJumpInfo.objectId = this.contentDetailData.newsId + ""
this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType + ""
this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId + ""
this.mJumpInfo.objectType =
(this.contentDetailData.newsType + "") == ContentConstants.TYPE_FOURTEEN ? this.contentDetailData.newsType + "" :
ContentConstants.TYPE_VOD
if (this.contentDetailData.videoInfo != null && this.contentDetailData.videoInfo.length > 0) {
this.mJumpInfo.videoInfo = this.contentDetailData.videoInfo[0]
}
}
caclImageRadius(index: number) {
let radius: radiusType = {
topLeft: index === 0 ? $r('app.float.image_border_radius') : 0,
... ... @@ -561,11 +637,11 @@ export struct DynamicDetailComponent {
return radius
}
getPicType(item: PhotoListBean){
getPicType(item: PhotoListBean) {
if (item.width && item.width) {
if (item.width / item.height > 343/172) {
if (item.width / item.height > 343 / 172) {
return 1; //横长图
} else if (item.height / item.width > 305/228) {
} else if (item.height / item.width > 305 / 228) {
return 2; //竖长图
} else {
return 3
... ... @@ -590,7 +666,7 @@ export struct DynamicDetailComponent {
attentionUserType: this.contentDetailData?.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
attentionUserId: this.contentDetailData?.rmhInfo?.userId || '', // 被关注用户号主id
attentionCreatorId: this.contentDetailData?.rmhInfo?.rmhId || '', // 被关注用户号主id
status: this.followStatus == '0'? 1:0,
status: this.followStatus == '0' ? 1 : 0,
}
ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
console.log('关注号主==', JSON.stringify(res.data))
... ...
... ... @@ -9,7 +9,7 @@ import font from '@ohos.font';
import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog';
import { RMCalendarBean } from './calendar/RMCalendarBean';
import { newsSkeleton } from './skeleton/newsSkeleton';
import { Logger, ToastUtils } from 'wdKit/Index';
import { Logger, ToastUtils, NetworkUtil } from 'wdKit/Index';
@Component
export struct ENewspaperPageComponent {
... ... @@ -82,6 +82,12 @@ export struct ENewspaperPageComponent {
this.screenWidth = this.displayTool.width
this.picWidth = this.screenWidth - vp2px(52)
this.picHeight = this.picWidth * 566 / 378
// 默认日期
const date = new Date()
const month = date.getMonth() + 1
const day = date.getDate()
this.calendarDate =
`${date.getFullYear()}-${month > 9 ? month : '0' + month}-${day > 9 ? day : '0' + day}`
//注册字体
font.registerFont({
familyName: 'BebasNeueBold',
... ... @@ -142,7 +148,7 @@ export struct ENewspaperPageComponent {
this.calendarDialogController.close()
}
})
if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
Image($r('app.media.icon_share'))
.height($r('app.float.top_arrow_size'))
.width($r('app.float.top_arrow_size'))
... ... @@ -155,6 +161,7 @@ export struct ENewspaperPageComponent {
ToastUtils.showToast('分享为公共方法,待开发', 1000);
})
}
}
.margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') })
.height($r('app.float.top_bar_height'))
.alignRules({
... ... @@ -260,12 +267,16 @@ export struct ENewspaperPageComponent {
})
.id('e_newspaper_page_num')
.onClick((event: ClickEvent) => {
if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
this.pageDialogShow = !this.pageDialogShow
if (this.pageDialogShow) {
this.pageDialogController.open()
} else {
this.pageDialogController.close()
}
}else {
ToastUtils.showToast('暂无数据', 1000)
}
})
// .bindPopup(this.pageNumPopup, {
... ... @@ -291,12 +302,17 @@ export struct ENewspaperPageComponent {
})
.id('e_newspaper_read')
.onClick((event: ClickEvent) => {
if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
this.isOpenListDialog = true
}else {
ToastUtils.showToast('暂无数据', 1000)
}
})
}
.width('100%')
.height('100%')
.backgroundColor($r('app.color.color_80000000'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.id('e_newspaper_container')
if (this.isOpenListDialog) {
... ... @@ -322,8 +338,12 @@ export struct ENewspaperPageComponent {
private async getNewspaperList() {
try {
if (NetworkUtil.isNetConnected()) {
let listBean = await NewspaperViewModel.getNewspaperList(this.calendarDate, this.picWidth + 'x' + this.picHeight)
this.newspaperListBean = listBean;
} else {
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
}
} catch (exception) {
}
... ...
import { FeedbackTypeBean } from 'wdBean/Index';
import { NetworkUtil } from 'wdKit/Index';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { CustomTitleUI } from './reusable/CustomTitleUI'
import { ArrayList } from '@kit.ArkTS';
const TAG = 'FeedBackActivity'
// 意见反馈页面
@Entry
@Component
export struct FeedBackActivity {
//UI
scroller: Scroller = new Scroller();
@State isNetConnected: boolean = true
@State feedbackTypeBeans: FeedbackTypeBean[] = [] as FeedbackTypeBean[]
async aboutToAppear() {
await this.getContentDetailData()
}
build() {
Column() {
//标题栏目
CustomTitleUI({ titleName: "意见反馈" })
Stack({ alignContent: Alignment.Bottom }) {
Scroll(this.scroller) {
Column() {
Text('请选择问题类型')
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_16'))
.fontWeight(FontWeight.Bold)
.margin({ left: $r('app.float.vp_15'), top: $r('app.float.vp_14') })
GridRow({
gutter: { x: 2, y: 2 }
}) {
ForEach(this.feedbackTypeBeans, (item: FeedbackTypeBean, index: number) => {
GridCol({
span: 12
}) {
Row(){
Toggle({ type: ToggleType.Checkbox, isOn: false })
Text(item.classifyName)
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_14'))
.fontWeight(FontWeight.Bold)
.margin({ left: $r('app.float.vp_4') })
}
.width(115)
.height(22)
.backgroundColor($r('app.color.color_fff'))
}
})
}
Blank()
.height(0.5)
.margin({ left: $r('app.float.vp_16'), top: $r('app.float.vp_12'), right: $r('app.float.vp_16') })
.backgroundColor($r('app.color.color_EDEDED'))
Text('描述您的问题')
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_16'))
.fontWeight(FontWeight.Bold)
.margin({ left: $r('app.float.vp_16'), top: $r('app.float.vp_12') })
Stack() {
TextInput({ placeholder: '您的宝贵意见是我们前行的动力' })
GridRow({
gutter: { x: 2, y: 2 }
}) {
ForEach(this.feedbackTypeBeans, (item: FeedbackTypeBean, index: number) => {
GridCol({
span: 12
}) {
}
})
}
Text('0/500')
}
.height(200)
.width('100%')
.margin({ left: $r('app.float.vp_16'), top: $r('app.float.vp_12'), right: $r('app.float.vp_16') })
.backgroundColor($r('app.color.color_F5F5F5'))
.borderRadius(4)
Text('期待您留下联系方式,我们将提供更好的服务')
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_14'))
.fontWeight(FontWeight.Bold)
.margin({ left: $r('app.float.vp_16'), top: $r('app.float.margin_24') })
Row() {
Text('电话或者邮箱')
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_14'))
.fontWeight(FontWeight.Bold)
.margin({ left: $r('app.float.vp_12') })
TextInput({ placeholder: '请输入电话或者邮箱' })
}
.height(44)
.margin({ left: $r('app.float.vp_16'), right: $r('app.float.vp_12'), top: $r('app.float.margin_16') })
.backgroundColor($r('app.color.color_F5F5F5'))
.borderRadius(4)
}
}
Text($r('app.string.submit'))
.height(44)
.fontColor($r('app.color.color_9E9E9E_40'))
.fontSize($r('app.float.font_size_18'))
.margin({ left: $r('app.float.vp_16'), right: $r('app.float.vp_16'), top: $r('app.float.vp_15') })
.backgroundColor($r('app.color.color_ED2800_99'))
.borderRadius(4)
}
}
}
/**
* 请求接口数据
* */
private async getContentDetailData() {
this.isNetConnected = NetworkUtil.isNetConnected()
try {
this.feedbackTypeBeans = await MultiPictureDetailViewModel.getFeedbackTypeList()
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
}
}
}
\ No newline at end of file
... ...
... ... @@ -40,7 +40,7 @@ const TAG: string = 'ImageAndTextPageComponent'
export struct ImageAndTextPageComponent {
scroller: Scroller = new Scroller();
action: Action = {} as Action
@State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO []
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@State recommendList: ContentDTO[] = []
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@State interactData: InteractDataDTO = {} as InteractDataDTO
... ... @@ -52,57 +52,35 @@ export struct ImageAndTextPageComponent {
@State isNetConnected: boolean = true
@State info: Area | null = null
@State likeNum: number = 0
build() {
Column() {
// 发布时间
Row() {
Image(this.contentDetailData[0]?.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)
@State reachEndIncreament: number = 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
build() {
Stack({ alignContent: Alignment.Top }) {
Stack({ alignContent: Alignment.Bottom }) {
Scroll(this.scroller) {
Column() {
ImageAndTextWebComponent({
contentDetailData: this.contentDetailData,
contentDetailData: [this.contentDetailData],
action: this.action,
isPageEnd: $isPageEnd
})
.padding({bottom:10})
.padding({ top: 15, bottom: 10 })
Column() {
// 点赞
if (this.contentDetailData[0]?.openLikes && this.contentDetailData[0]?.likesStyle !== 4) {
if (this.contentDetailData?.openLikes && this.contentDetailData?.likesStyle !== 4) {
Row() {
Row() {
if (this.newsStatusOfUser?.likeStatus === '1') {
Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.ic_like_check') :
(this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer_active') :
Image(this.contentDetailData?.likesStyle === 1 ? $r('app.media.ic_like_check') :
(this.contentDetailData?.likesStyle === 2 ? $r('app.media.icon_prayer_active') :
$r('app.media.icon_candle_active')))
.width(24)
.height(24)
.margin({ right: 5 })
} else {
Image(this.contentDetailData[0]?.likesStyle === 1 ? $r('app.media.icon_like') :
(this.contentDetailData[0]?.likesStyle === 2 ? $r('app.media.icon_prayer') :
Image(this.contentDetailData?.likesStyle === 1 ? $r('app.media.icon_like') :
(this.contentDetailData?.likesStyle === 2 ? $r('app.media.icon_prayer') :
$r('app.media.icon_candle')))
.width(24)
.height(24)
... ... @@ -129,7 +107,7 @@ export struct ImageAndTextPageComponent {
})
}.width(CommonConstants.FULL_WIDTH)
.padding({top:14,bottom:24})
.padding({ top: 14, bottom: 24 })
.justifyContent(FlexAlign.Center)
}
if (this.recommendList.length > 0) {
... ... @@ -137,10 +115,15 @@ export struct ImageAndTextPageComponent {
RecommendList({ recommendList: this.recommendList })
}
// 评论
if (this.contentDetailData[0]?.openComment) {
if (this.contentDetailData?.openComment) {
Divider().strokeWidth(6).color('#f5f5f5')
CommentComponent({
publishCommentModel: this.publishCommentModel
publishCommentModel: this.publishCommentModel,
fixedHeightMode: false,
reachEndIncreament: this.reachEndIncreament,
reachEndLoadMoreFinish: () => {
}
}).onAreaChange((oldValue: Area, newValue: Area) => {
this.info = newValue
})
... ... @@ -149,13 +132,14 @@ 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(() => {
this.reachEndIncreament += 1
})
if (!this.isNetConnected) {
EmptyComponent({
... ... @@ -167,24 +151,52 @@ export struct ImageAndTextPageComponent {
}).padding({ bottom: 200 })
} else {
if (!this.isPageEnd) {
detailedSkeleton()
detailedSkeleton().padding({ bottom: this.bottomSafeHeight })
}
}
//底部交互区
if (this.operationButtonList.length) {
// 底部交互区
OperRowListView({
contentDetailData: this.contentDetailData[0],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
operationButtonList: this.operationButtonList,
styleType: 1,
})
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.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)
.backgroundColor(Color.White)
}
private async getDetail() {
... ... @@ -207,29 +219,30 @@ export struct ImageAndTextPageComponent {
}
let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
if (detailBeans && detailBeans.length > 0) {
this.contentDetailData = detailBeans;
this.contentDetailData = detailBeans[0];
let dateTime =
DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
DateTimeUtils.parseDate(this.contentDetailData?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime)
if (this.contentDetailData[0]?.recommendShow === 1) {
if (this.contentDetailData?.recommendShow === 1) {
this.getRecommend()
}
if (this.contentDetailData[0]?.openLikes === 1) {
if (this.contentDetailData?.openLikes === 1) {
this.getInteractDataStatus()
this.queryContentInteractCount()
}
if (this.contentDetailData[0]?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType)
}
if (this.contentDetailData[0]?.openAudio && this.contentDetailData[0]?.audioList?.length &&
this.contentDetailData[0]?.audioList[0].audioUrl) {
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)
}
if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length &&
this.contentDetailData?.audioList[0].audioUrl) {
this.operationButtonList = ['comment', 'collect', 'listen', 'share']
} else {
this.operationButtonList = ['comment', 'collect', 'share']
... ... @@ -242,14 +255,18 @@ export struct ImageAndTextPageComponent {
let params: postRecommendListParams = {
imei: HttpUtils.getImei(),
userId: HttpUtils.getUserId(),
contentId: String(this.contentDetailData[0]?.newsId),
recType: Number(this.contentDetailData[0]?.reLInfo?.relType),
contentType: this.contentDetailData[0]?.newsType,
relId: this.contentDetailData[0]?.reLInfo?.relId,
channelId: String(this.contentDetailData[0]?.reLInfo?.channelId)
contentId: String(this.contentDetailData?.newsId),
recType: Number(this.contentDetailData?.reLInfo?.relType),
contentType: this.contentDetailData?.newsType,
relId: this.contentDetailData?.reLInfo?.relId,
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');
}
}
// 已登录->查询用户对作品点赞、收藏状态
... ... @@ -258,8 +275,8 @@ export struct ImageAndTextPageComponent {
const params: batchLikeAndCollectParams = {
contentList: [
{
contentId: this.contentDetailData[0]?.newsId + '',
contentType: this.contentDetailData[0]?.newsType + '',
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
}
]
}
... ... @@ -284,8 +301,8 @@ export struct ImageAndTextPageComponent {
}
const params: postExecuteLikeParams = {
status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1',
contentId: this.contentDetailData[0]?.newsId + '',
contentType: this.contentDetailData[0]?.newsType + '',
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
}
PageRepository.postExecuteLike(params).then(res => {
console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',)
... ... @@ -304,8 +321,8 @@ export struct ImageAndTextPageComponent {
console.error(TAG, 'contentDetailData2222', JSON.stringify(this.contentDetailData))
const params: contentListParams = {
contentList: [{
contentId: this.contentDetailData[0]?.newsId + '',
contentType: this.contentDetailData[0]?.newsType,
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType,
}]
}
PageRepository.getContentInteract(params).then(res => {
... ...
import { ContentDTO } from 'wdBean/Index';
import { ProcessUtils } from 'wdRouter/Index';
import { InteractMessageModel } from '../../model/InteractMessageModel'
@Component
export struct InteractMComponent {
messageModel:InteractMessageModel = new InteractMessageModel;
///"remark": "{"beReply":"乐事薯片,大家的最爱!!",
// "headUrl":"https: //uatjdcdnphoto.aikan.pdnews.cn//zhbj/img/user/2023122211/2A59F725E69849A38CEE8823B0D9D141.jpg",
// "contentId":"30035774121","contentRelObjectid":"2012","contentTitle":"乐事推出华夏风光限定罐七款城市地标包装让出游“有滋有味”",
// "commentContent":"大家都爱吃!!","userName":"人民日报网友a8dKCV","userId":"504964178466309","contentRelId":"500002866426",
// "shareUrl":"https: //pd-people-uat.pdnews.cn/column/30035774121-500002866426","userType":"1",
// "contentRelType":"1","visitor":"0","contentType":"8"}",
build() {
Row(){
Image(this.messageModel.InteractMsubM.headUrl)
.width(36)
.height(36)
.borderRadius(18)
Column(){
Row(){
Text(this.messageModel.InteractMsubM.userName)
.fontSize('14fp').fontColor('#222222')
Text(this.buildContentString())
.fontSize('14fp').fontColor('#999999')
.margin({left:5})
}.width('100%')
Text(this.messageModel.time)
.margin({top:2})
.fontSize('12fp').fontColor('#B0B0B0').margin({top:10,bottom:10})
if (this.messageModel.contentType === '208' || this.messageModel.contentType === '209'){
Text(this.messageModel.message)
.margin({bottom:10})
.fontSize('16fp').fontColor('#222222')
.width('100%')
.constraintSize({maxHeight:500})
}
Column(){
if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){
Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500})
.margin({top:15,bottom:10})
.width('100%')
Divider()
.color('#EDEDED')
.backgroundColor('#EDEDED')
.width('100%')
.height(1)
}
Row(){
Image($r('app.media.MessageOriginTextIcon'))
.width('12')
.height('12')
Text(this.messageModel.InteractMsubM.contentTitle)
.fontSize('12fp')
.fontColor('#666666')
.maxLines(1)
.width('90%')
.textOverflow({overflow:TextOverflow.Ellipsis})
Blank()
Image($r('app.media.mine_user_edit'))
.width('12')
.height('12')
}.margin({top:10,bottom:15})
}.padding({left:10,right:10}).alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5)
.onClick(()=>{
let contentDTO :ContentDTO = new ContentDTO();
contentDTO.objectType = this.messageModel.InteractMsubM.contentType
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)
}
buildContentString(): string {
let contentString: string = ''
if (this.messageModel.contentType === '206') {
contentString = '赞了你的作品'
}else if(this.messageModel.contentType === '207'){
contentString = '赞了你的评论'
}else if(this.messageModel.contentType === '208'){
contentString = '评论了你的作品'
}else if(this.messageModel.contentType === '209'){
contentString = '回复了你的评论'
}else if(this.messageModel.contentType === '210'){
contentString = '转发了您的作品'
}else if(this.messageModel.contentType === '211'){
contentString = '关注了你'
}
return contentString;
}
buildCommentContent(): string {
let contentString : string = this.messageModel.contentType === '207'?this.messageModel.message:this.messageModel.InteractMsubM.beReply;
return contentString;
}
}
\ No newline at end of file
... ...
... ... @@ -61,6 +61,8 @@ export struct MorningEveningPaperComponent {
@State mixedBgColor: string = ''
// 顶部安全高度赋值
@State topSafeHeight: number = 0;
@State bottomSafeHeight: number = 0;
private audioDataList: AudioDataList[] = []
private playerController: WDPlayerController = new WDPlayerController();
simpleAudioDialog: CustomDialogController = new CustomDialogController({
... ... @@ -112,6 +114,7 @@ export struct MorningEveningPaperComponent {
// await windowHight.setWindowLayoutFullScreen(true);
// WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height)
this.bottomSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height)
const dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String
console.info(TAG, `aboutToAppear = ` + dailyPaperTopicPageId)
... ... @@ -249,14 +252,15 @@ export struct MorningEveningPaperComponent {
})
}
}
.height('100%')
.height(`calc(100% - ${this.bottomSafeHeight + this.topSafeHeight + 'vp'})`)
PaperTitleComponent()
}
.width('100%')
.height('100%')
.padding({
top: this.topSafeHeight
top: this.topSafeHeight,
bottom: this.bottomSafeHeight
})
// .backgroundColor(Color.Black)
// .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black)
... ...
... ... @@ -114,7 +114,7 @@ export struct SingleColumn999Component {
build() {
// if (this.compDTO && this.compDTO?.operDataList?.length > 0) {
if (this.compListItem && this.compListItem?.operDataList?.length > 0) {
List({ space: 2, initialIndex: 0 }) {
List({ initialIndex: 0 }) {
// ListItemGroup({
// // footer: this.itemFooter("")
// }) {
... ...
import { NetworkUtil, Logger, NetworkType, SPHelper, WindowModel, StringUtils} from 'wdKit';
import { NetworkUtil, Logger, NetworkType, SPHelper, WindowModel, StringUtils } from 'wdKit';
import { ResponseDTO } from 'wdNetwork';
import {
ContentDetailDTO,
... ... @@ -35,7 +35,7 @@ export struct MultiPictureDetailPageComponent {
private picWidth: number = 0
@State picHeight: number = 0
@State titleHeight: number = 0
@State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01'
private swiperController: SwiperController = new SwiperController()
private swiperControllerItem: SwiperController = new SwiperController()
... ... @@ -49,8 +49,8 @@ export struct MultiPictureDetailPageComponent {
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') as number;
@State windowHeight: number = AppStorage.get<number>('windowHeight') as number;
@State currentOffset:number = 0
@State duration:number = 0
@State currentOffset: number = 0
@State duration: number = 0
//watch监听页码回调
onCurrentPageNumUpdated(): void {
... ... @@ -83,7 +83,6 @@ export struct MultiPictureDetailPageComponent {
}
}
aboutToDisappear() {
}
... ... @@ -101,10 +100,10 @@ export struct MultiPictureDetailPageComponent {
@Builder
init() {
if (this.contentDetailData.rmhPlatform == 1) {
if(!this.showDownload) {
if (!this.showDownload) {
Row() {
Row({ space: 8 }) {
if (this.getImgUrl()){
if (this.getImgUrl()) {
Row() {
Stack() {
Image(this.getImgUrl())
... ... @@ -115,7 +114,7 @@ export struct MultiPictureDetailPageComponent {
.height(36)
.objectFit(ImageFit.Fill)
.interpolation(ImageInterpolation.High)
if(!StringUtils.isEmpty(this.contentDetailData.rmhInfo?.authIcon)){
if (!StringUtils.isEmpty(this.contentDetailData.rmhInfo?.authIcon)) {
Stack() {
Image(this.contentDetailData.rmhInfo?.authIcon)
.width($r('app.float.vp_13'))
... ... @@ -219,7 +218,7 @@ export struct MultiPictureDetailPageComponent {
.width('100%')
.height(44)
.zIndex(10)
.margin({top:`${this.topSafeHeight + 12}px`})
.margin({ top: `${this.topSafeHeight + 12}px` })
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
... ... @@ -249,12 +248,12 @@ export struct MultiPictureDetailPageComponent {
this.currentOffset = Math.abs(extraInfo.currentOffset)
})
.onTouch((event: TouchEvent) => {
if(this.duration === 0) {
if (this.duration === 0) {
this.duration = 500
}
if(event.type === 1) {
if (event.type === 1) {
// if(this.currentOffset > px2vp((this.windowHeight - item.height)/2 - 100)) {
if(this.currentOffset > 160) {
if (this.currentOffset > 160) {
router.back()
}
}
... ... @@ -270,6 +269,7 @@ export struct MultiPictureDetailPageComponent {
.indicator(false)
.displayCount(1)
.loop(false)
.effectMode(EdgeEffect.None)
.id('e_swiper_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
... ... @@ -295,9 +295,9 @@ export struct MultiPictureDetailPageComponent {
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
}
Column(){
if(!this.showDownload) {
Column(){
Column() {
if (!this.showDownload) {
Column() {
Row() {
Scroll(this.scroller) {
Row() {
... ... @@ -305,7 +305,7 @@ export struct MultiPictureDetailPageComponent {
direction: FlexDirection.Column,
justifyContent: FlexAlign.Start
}) {
if(this.contentDetailData?.photoList?.length) {
if (this.contentDetailData?.photoList?.length) {
Text() {
Span(`${this.swiperIndex + 1}`)
.fontSize(24)
... ... @@ -321,7 +321,7 @@ export struct MultiPictureDetailPageComponent {
.fontColor(Color.White)
.margin(4)
}
if(this.contentDetailData.newsTitle) {
if (this.contentDetailData.newsTitle) {
Text(`${this.contentDetailData.newsTitle}`)
.fontColor(Color.White)
.fontSize(16)
... ... @@ -335,7 +335,7 @@ export struct MultiPictureDetailPageComponent {
right: 0
})
}
if(this.contentDetailData.photoList?.[this.swiperIndex].picDesc) {
if (this.contentDetailData.photoList?.[this.swiperIndex].picDesc) {
Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`)
.fontColor(Color.White)
.fontSize(14)
... ... @@ -360,25 +360,27 @@ export struct MultiPictureDetailPageComponent {
.height(px2vp(this.titleHeight))
.align(Alignment.Bottom)
}
OperRowListView({
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
operationButtonList: this.operationButtonList,
styleType: 2,
componentType:5,
})
}
.transition(TransitionEffect.OPACITY.animation({ duration: this.duration, curve: Curve.Ease }).combine(
TransitionEffect.translate({ x: 0, y: `-${this.bottomSafeHeight}px` })
))
}
if(this.showDownload) {
Column(){
if (this.showDownload) {
Column() {
Row() {
Flex({
direction: FlexDirection.Row,
justifyContent: FlexAlign.SpaceBetween
}) {
if(this.contentDetailData?.photoList?.length) {
if (this.contentDetailData?.photoList?.length) {
Text() {
Span(`${this.swiperIndex + 1}`)
.fontSize(24)
... ... @@ -395,7 +397,7 @@ export struct MultiPictureDetailPageComponent {
.margin(4)
}
if(this.contentDetailData.photoList?.[this.swiperIndex].picPath) {
if (this.contentDetailData.photoList?.[this.swiperIndex].picPath) {
ImageDownloadComponent({ url: this.contentDetailData.photoList?.[this.swiperIndex].picPath })
.margin({
top: 8,
... ... @@ -448,6 +450,7 @@ export struct MultiPictureDetailPageComponent {
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 } from 'wdKit';
const TAG: string = 'SpacialTopicPageComponent'
... ... @@ -18,12 +20,14 @@ export struct SpacialTopicPageComponent {
action: Action = {} as Action
@State webUrl: string = '';
@State isPageEnd: boolean = false
@State contentDetailData: ContentDetailDTO [] = [] as ContentDetailDTO []
@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 +49,8 @@ export struct SpacialTopicPageComponent {
}
private async getDetail() {
this.isNetConnected = NetworkUtil.isNetConnected()
let contentId: string = ''
let relId: string = ''
let relType: string = ''
... ... @@ -63,15 +69,16 @@ export struct SpacialTopicPageComponent {
}
let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
if (detailBeans && detailBeans.length > 0) {
this.contentDetailData = detailBeans;
this.contentDetailData = detailBeans[0];
// if (this.contentDetailData[0]?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType)
this.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.trySendData2H5()
}
... ... @@ -92,17 +99,30 @@ export struct SpacialTopicPageComponent {
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.padding({bottom:75})
.padding({ bottom: 75 })
if (!this.isNetConnected) {
EmptyComponent({
emptyType: 1,
emptyButton: true,
retry: () => {
this.getDetail()
}
}).padding({ bottom: 200 })
} else {
if (!this.isPageEnd) {
detailedSkeleton()
}
}
//底部交互区
OperRowListView({
contentDetailData: this.contentDetailData[0],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
operationButtonList: this.operationButtonList,
})
.padding({
bottom: `${this.bottomSafeHeight}px`
})
}
}.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
}
... ...
import { RMCalendarBean } from './RMCalendarBean'
import { RMCalenderCell } from './RMCalendarCell'
import { ToastUtils, NetworkUtil } from 'wdKit/Index';
@Component
export struct RMCalendar {
... ... @@ -166,6 +167,9 @@ export struct RMCalendar {
* 下一个月
*/
private nextMonth() {
if (!NetworkUtil.isNetConnected()) {
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
}
// this.dates.slice(0, this.dates.length)
this.dates = []
const beforDate = new Date(this.selectDay.getFullYear(), this.selectDay.getMonth())
... ... @@ -180,6 +184,9 @@ export struct RMCalendar {
* 上一个月
*/
private preMonth() {
if (!NetworkUtil.isNetConnected()) {
ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
}
// this.dates.slice(0, this.dates.length)
this.dates = []
const beforDate = new Date(this.selectDay.getFullYear(), this.selectDay.getMonth())
... ...
... ... @@ -51,6 +51,7 @@ export struct CardSourceInfo {
.fontColor($r("app.color.color_B0B0B0"))
.flexShrink(0)
.margin({ left: 6 })
.visibility(Number(this.contentDTO?.interactData?.commentNum) === 0 ? Visibility.None : Visibility.Visible)
}
}
.width(CommonConstants.FULL_WIDTH)
... ...
/**
* 这里是人民号动态中的顶部信息:人民号logo,名字,描述,关注等
*/
import {
ContentDetailRequest,
postInteractAccentionOperateParams
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { RmhInfoDTO } from 'wdBean'
import { CommonConstants } from 'wdConstant/Index';
import { DateTimeUtils } from 'wdKit';
import { DateTimeUtils, SPHelper, Logger, ToastUtils } from 'wdKit';
import { SpConstants } from 'wdConstant/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import router from '@ohos.router'
import { postBatchAttentionStatusParams } from 'wdBean/Index';
import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'
@Component
export struct RmhTitle {
@Prop rmhInfo: RmhInfoDTO
@Prop publishTime: string | undefined
/**
* 是否需要隐藏发布时间超过2天的时间展示,默认不隐藏
*/
@Prop hideTime: boolean
/**
* 默认未关注 点击去关注
*/
@State followStatus: string = '0';
/**
* 关注号主
*/
async handleAccention() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
const params2: postInteractAccentionOperateParams = {
attentionUserType: this.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
attentionUserId: this.rmhInfo?.userId || '', // 被关注用户号主id
attentionCreatorId: this.rmhInfo?.rmhId || '', // 被关注用户号主id
status: this.followStatus == '0' ? 1 : 0,
}
ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
console.log('rmhTitle-data', JSON.stringify(res.data))
if (this.followStatus == '1') {
this.followStatus = '0'
} else {
this.followStatus = '1'
// 弹窗样式与何时调用待确认
ContentDetailRequest.postPointLevelOperate({ operateType: 6 }).then((res) => {
console.log('关注号主获取积分==', JSON.stringify(res.data))
if (res.data?.showToast) {
ToastUtils.showToast(res.data.ruleName + '+' + res.data.rulePoint + '积分', 1000);
}
})
}
})
}
/**
* 查询当前登录用户是否关注作品号主
* */
async getBatchAttentionStatus() {
try {
const params: postBatchAttentionStatusParams = {
creatorIds: [{ creatorId: this.rmhInfo?.rmhId ?? '' }]
}
let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
this.followStatus = data[0]?.status;
Logger.info(`rmhTitle-followStatus:${JSON.stringify(this.followStatus)}`)
} catch (exception) {
Logger.info(`rmhTitle-followStatus:${JSON.stringify(exception)}`)
}
}
aboutToAppear(): void {
this.getBatchAttentionStatus()
let page = router.getState();
if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) {
this.hideTime = true;
}
}
getDaysBetweenDates(date: number) {
const oneDay = 24 * 60 * 60 * 1000; // 一天的毫秒数
const time1 = new Date().getTime(); // 今天日期的时间戳
const time2 = new Date(date).getTime(); // 要比较日期的时间戳
const diffDays = Math.round(Math.abs((time1 - time2) / oneDay)); // 两个日期时间戳差值除以一天的毫秒数得到天数,取绝对值并四舍五入
return Math.ceil(diffDays);
}
build() {
Flex() {
... ... @@ -33,6 +116,7 @@ export struct RmhTitle {
.alignSelf(ItemAlign.Start)
Flex({alignContent: FlexAlign.Start, wrap: FlexWrap.NoWrap}) {
Row() {
if (!(this.hideTime && this.getDaysBetweenDates(Number(this.publishTime)) > 2)) {
if (this.publishTime) {
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime)))
.fontSize($r("app.float.font_size_12"))
... ... @@ -43,6 +127,7 @@ export struct RmhTitle {
.width(16)
.height(16)
}
}
Text(this.rmhInfo.rmhDesc)
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
... ... @@ -58,17 +143,20 @@ export struct RmhTitle {
Blank()
if (this.rmhInfo.cnIsAttention) {
Row() {
if (Number(this.followStatus) === 0) {
Image($r('app.media.rmh_follow'))
.width(16)
.height(16)
Text('关注')
}
Text(Number(this.followStatus) === 0 ? '关注' : '已关注')
.fontSize($r('app.float.font_size_13'))
.fontColor($r('app.color.color_ED2800'))
}
.flexShrink(0)
.alignSelf(ItemAlign.Center)
.onClick(() => {
// TODO 调用关注接口
this.handleAccention();
})
}
}
... ...
import { CompDTO } from 'wdBean/Index';
import { Logger } from 'wdKit/Index';
import { DateTimeUtils, Logger } from 'wdKit/Index';
import PageModel from '../../viewmodel/PageModel';
/**
... ... @@ -59,9 +59,9 @@ export struct CardAdvBottom {
break;
}
}
Logger.error("ZZZXXXXX","currentIndex====>"+currentIndex);
if (currentIndex >= 0) {
this.pageModel.compList.deleteItem(currentIndex)
this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
}
}
}
... ...
import { CompDTO } from 'wdBean/Index';
import { Logger } from 'wdKit/Index';
import { DateTimeUtils, Logger } from 'wdKit/Index';
import PageModel from '../../viewmodel/PageModel';
/**
... ... @@ -71,10 +71,9 @@ export struct CardAdvTop {
break;
}
}
Logger.error("ZZZXXXXX","currentIndex====>"+currentIndex);
if (currentIndex >= 0) {
this.pageModel.compList.deleteItem(currentIndex)
this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
}
}
}
... ...
... ... @@ -48,8 +48,9 @@ export struct Card10Component {
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
if (this.contentDTO.objectType == '5') {
Notes({ objectType: 5 }).margin({ left: 5, bottom: 5 })
}
}.alignContent(Alignment.BottomStart)
// 专题列表--后端返回三个,
... ... @@ -106,7 +107,7 @@ export struct Card10Component {
.fontColor($r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(item.objectType == '5' ? 40 : 0)
.textIndent(item.objectType == '5' ? 38 : 0)
}.alignContent(Alignment.TopStart)
CardSourceInfo(
... ...
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';
... ... @@ -23,7 +22,6 @@ export struct Card17Component {
this.loadImg = await onlyWifiLoadImg();
}
build() {
Column({ space: 8 }) {
Text(this.contentDTO.newsTitle)
... ... @@ -38,7 +36,8 @@ 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)
... ... @@ -49,7 +48,8 @@ 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)
... ... @@ -65,7 +65,8 @@ 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)
... ... @@ -94,6 +95,7 @@ export struct Card17Component {
};
WDRouterRule.jumpWithAction(taskAction)
})
// 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
}
... ...
... ... @@ -102,6 +102,9 @@ struct createImg {
CardMediaInfo({ contentDTO: this.contentDTO })
}
.align(Alignment.BottomEnd)
.onClick((event: ClickEvent) => {
ProcessUtils.gotoVod(this.contentDTO)
})
}
}
}
... ...
... ... @@ -40,7 +40,7 @@ export struct Card2Component {
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
.textIndent(this.contentDTO.objectType == '5' ? 40 : 0)
.textIndent(this.contentDTO.objectType == '5' ? 35 : 0)
}
.alignContent(Alignment.TopStart)
... ...
... ... @@ -12,7 +12,7 @@ const TAG: string = 'Card5Component';
@Component
export struct Card5Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State titleShowPolicy: number | string = 1
@Prop titleShowPolicy: number | string
@State loadImg: boolean = false;
@State clicked: boolean = false;
... ... @@ -22,12 +22,13 @@ export struct Card5Component {
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 || this.contentDTO.titleShow === 1) && this.contentDTO.newsTitle) {
if (this.titleShowPolicy === 1) {
Row()
.width(CommonConstants.FULL_WIDTH)
.height(59)
... ... @@ -41,20 +42,21 @@ export struct Card5Component {
if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text(this.contentDTO.newsTitle)
.width(CommonConstants.FULL_WIDTH)// .height(CommonConstants.FULL_HEIGHT)
.width(CommonConstants.FULL_WIDTH)
.fontColor(Color.White)
.fontSize($r('app.float.normal_text_size'))
.fontWeight(FontWeight.Bold)
.maxLines(2)
.align(Alignment.TopStart)
.textIndent(this.contentDTO.objectType == '5' ? 40 : 0)
.textIndent(this.contentDTO.objectType == '5' ? 35 : 0)
}.alignContent(Alignment.TopStart)
}
.justifyContent(FlexAlign.Start)
// .height(40)
.margin({ left: 12, bottom: 10, right: 12 })
// }
}
}
.alignContent(Alignment.Bottom)
.width(CommonConstants.FULL_WIDTH)
... ...
... ... @@ -38,17 +38,21 @@ export struct Card6Component {
Stack() {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags })
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text(`${this.contentDTO.newsTitle}`)
.fontColor(this.clicked ? 0x848484 : 0x222222)
.fontSize(16)
.lineHeight(24)
.fontWeight(FontWeight.Normal)
.maxLines(3)
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 60 :
this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length < 3 ? 30 : 0)
.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)
}.height("80%")
... ... @@ -64,10 +68,10 @@ export struct Card6Component {
Stack() {
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.backgroundColor( this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.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)
... ...
... ... @@ -43,8 +43,11 @@ export struct Card9Component {
topRight: $r('app.float.image_border_radius')
})
if (this.contentDTO.objectType == '5') {
Notes({ objectType: 5 })
.margin({ left: 5, bottom: 5 })
}
}.alignContent(Alignment.BottomStart)
// 时间线--后端返回三个,
... ... @@ -136,13 +139,13 @@ export struct Card9Component {
.textOverflow({ overflow: TextOverflow.Ellipsis })
.alignSelf(ItemAlign.Center)
.margin({ left: 12 })
if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {
Image(this.loadImg? item.fullColumnImgUrls[0].url : '')
.backgroundColor(0xf5f5f5)
.width(90)
.height(60)
.borderRadius($r('app.float.image_border_radius'))
}
// if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {
// Image(this.loadImg? item.fullColumnImgUrls[0].url : '')
// .backgroundColor(0xf5f5f5)
// .width(90)
// .height(60)
// .borderRadius($r('app.float.image_border_radius'))
// }
}
}
}
... ...
... ... @@ -13,10 +13,10 @@ export struct Notes {
build() {
if (this.returnTypeTitleFn()) {
Text(this.returnTypeTitleFn())
.fontSize($r('app.float.font_size_12'))
.fontSize($r('app.float.font_size_11'))
.padding({
left: 5,
right: 5,
left: 4,
right: 4,
top: 3,
bottom: 3
})
... ...
... ... @@ -20,6 +20,8 @@ export class publishCommentModel {
targetType: string = ''
/*评论总数*/
totalCommentNumer: string = '0'
/// 游客评论开关:visitorComment 1:打开;0:关闭
visitorComment: string = "0"
//评论传参
/*评论图片url,多个逗号隔开*/
... ...
... ... @@ -6,10 +6,13 @@ import { CommentCustomDialog } from './CommentCustomDialog';
import { publishCommentModel } from '../model/PublishCommentModel';
import { HttpUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import NoMoreLayout from '../../page/NoMoreLayout';
import { EmptyComponent } from '../../view/EmptyComponent';
import { ContentDetailDTO, Params } from 'wdBean/Index';
const TAG = 'CommentComponent';
const testString = '因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸'
// @Entry
... ... @@ -18,15 +21,23 @@ const testString = '因为读书的人\n是低着头向上看的人\n身处一
export struct CommentComponent {
@State hasMore: boolean = true;
@State currentPage: number = 1;
// @State private browSingModel: commentListModel = new commentListModel()
@State isComments: boolean = true
/*必传*/
@ObjectLink publishCommentModel: publishCommentModel
@Consume contentDetailData: ContentDetailDTO
listScroller: ListScroller = new ListScroller(); // scroller控制器
historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset
isloading: boolean = false
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
@State dialogController: CustomDialogController | null = null;
// @State private browSingModel: commentListModel = new commentListModel()
// 是否为固定高度模式。true时,里面上拉加载更多生效,外层不能包Scroll。
// false时,外层实现加载更多,并通过reachEndIncreament通知开发加载更多,reachEndLoadMoreFinish 通知上层加载更多完成
fixedHeightMode: boolean = false
@Prop @Watch("parentOnReachEnd") reachEndIncreament : number = 0
reachEndLoadMoreFinish?: () => void
// 在自定义组件即将析构销毁时将dialogControlle置空
aboutToDisappear() {
this.dialogController = null // 将dialogController置空
... ... @@ -137,9 +148,16 @@ export struct CommentComponent {
List({ scroller: this.listScroller }) {
ListItemGroup({ header: this.titleHeader() })
if (!this.isComments) {
EmptyComponent({ emptyType: 17 })
.height(300)
} else {
LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
if (item.hasMore) {
ListItemGroup({ header: this.CommentHeaderItem(item, index), footer: this.GroupFooterView(item, index) }) {
ListItemGroup({
header: this.CommentHeaderItem(item, index),
footer: this.GroupFooterView(item, index)
}) {
LazyForEach(item.childCommentsLazyDataSource, (childItem: commentItemModel, subIndex: number) => {
ListItem() {
ChildCommentItem({
... ... @@ -173,30 +191,49 @@ export struct CommentComponent {
// 加载更多
ListItem() {
if (this.hasMore === false) {
// NoMoreLayout()
EmptyComponent({ emptyType: 17 })
.height(300)
if (this.hasMore == false) {
NoMoreLayout()
}
}
}
}
.margin({bottom: 10})
.onReachEnd(() => {
if (!this.fixedHeightMode) {
return
}
if (this.hasMore) {
this.getData()
}
})
.enableScrollInteraction(false)
.enableScrollInteraction(this.fixedHeightMode ? true: false)
// .nestedScroll({
// scrollForward: NestedScrollMode.PARENT_FIRST,
// scrollBackward: NestedScrollMode.SELF_FIRST
// })
}
}
parentOnReachEnd() {
if (this.fixedHeightMode) {
return
}
if (this.hasMore) {
this.getData()
} else {
if (this.reachEndLoadMoreFinish) {
this.reachEndLoadMoreFinish()
}
}
}
//获取数据
async getData() {
commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId,
this.publishCommentModel.targetType)
.then(commentListModel => {
console.log('评论:', JSON.stringify(commentListModel.list))
this.currentPage++
if (Number.parseInt(commentListModel.totalCommentNum) >
... ... @@ -204,6 +241,10 @@ export struct CommentComponent {
this.publishCommentModel.totalCommentNumer = commentListModel.totalCommentNum + ''
}
if (commentListModel.list.length === 0) {
this.isComments = false
}
if (commentListModel.hasNext === 0) {
this.hasMore = false;
} else {
... ... @@ -225,8 +266,10 @@ export struct CommentComponent {
} else {
this.hasMore = false
}
if (!this.fixedHeightMode && this.reachEndLoadMoreFinish) {
this.reachEndLoadMoreFinish()
}
})
}
}
... ... @@ -236,6 +279,7 @@ struct ChildCommentItem {
@Link publishCommentModel: publishCommentModel
@Link dialogController: CustomDialogController | null
@ObjectLink item: commentItemModel
@Consume contentDetailData: ContentDetailDTO
build() {
Column() {
... ... @@ -260,6 +304,14 @@ struct ChildCommentItem {
.alignContent(Alignment.Center)
.onClick(() => {
// TODO 跳转个人详情
// 跳转到号主页
if (this.contentDetailData.rmhInfo?.cnMainControl === 1) {
const params: Params = {
creatorId: this.contentDetailData.rmhInfo.rmhId,
pageID: ''
}
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
})
//昵称
... ... @@ -444,7 +496,7 @@ struct commentHeaderView {
.margin({ left: 8 })
.alignContent(Alignment.Center)
.onClick(() => {
// TODO 跳转个人详情
commentViewModel.jumpToAccountPage(this.item)
})
//昵称
... ...
import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index'
import { publishCommentModel } from '../model/PublishCommentModel'
@CustomDialog
export struct CommentListDialog {
/// 内部使用
private publishCommentModel: publishCommentModel = new publishCommentModel()
controller?: CustomDialogController
/// 外部初始化
contentDetail?: ContentDetailDTO
pageInfo?: PageInfoDTO
build() {
}
}
\ No newline at end of file
... ...
... ... @@ -11,11 +11,12 @@ export struct CommentTabComponent {
}
@ObjectLink publishCommentModel: publishCommentModel
@Prop contentDetail: ContentDetailDTO
@Prop pageComponentType: number = -1 //1:视频详情页
/*展示类型*/
@State type: number = 1
@State placeHolder: string = '说两句...'
@State dialogController: CustomDialogController | null = null;
styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
/*回调方法*/
dialogControllerConfirm: () => void = () => {
}
... ... @@ -46,9 +47,36 @@ export struct CommentTabComponent {
Row() {
Stack({ alignContent: Alignment.Start }) {
RelativeContainer() {
if (this.pageComponentType === 1) {
Row() {
}
.width('100%')
.height(30)
.borderRadius(2)
.backgroundColor(this.pageComponentType === 1 ? '#1a1a1a' : Color.Transparent)
.margin({
right: 16,
})
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start },
right: { anchor: "__container__", align: HorizontalAlign.End },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
})
.id("RowBg")
} else {
Image($r('app.media.comment_img_input_hui'))
.objectFit(ImageFit.Fill)
.resizable({ slice: { top: 1, left: 1, right: 20, bottom: 1 } })
.resizable({
slice: {
top: 1,
left: 1,
right: 20,
bottom: 1
}
})
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start },
... ... @@ -56,6 +84,7 @@ export struct CommentTabComponent {
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
})
.id("Image")
}
Text(this.placeHolder)
.fontSize(12)
.fontColor('#999999')
... ... @@ -91,7 +120,7 @@ export struct CommentIconComponent {
@ObjectLink publishCommentModel: publishCommentModel
/*展示类型*/
@State type: number = 1
styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
// aboutToAppear(): void {
// setTimeout(() => {
// this.publishCommentModel.totalCommentNumer = '444'
... ...
... ... @@ -412,33 +412,7 @@ struct QualityCommentItem {
jumpToAccountOwner() {
let url = HttpUrlUtils.getOtherUserDetailDataUrl()
let item : Record<string, string >= {
"creatorId": this.item.fromCreatorId || "",
"userType": `${this.item.fromUserType}`,
"userId": this.item.fromUserId || "-1",
}
HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => {
if (!result.data || result.data.mainControl != 1) {
ToastUtils.longToast("暂时无法查看该创作者主页")
return
}
if (result.data.banControl == 1) {
ToastUtils.longToast("该账号已封禁,不予访问")
return
}
if (result.data.userType === "1") { // 普通用户
let params: Record<string, string> = {'userId': result.data.userId};
WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
} else { // 非普通用户
ProcessUtils.gotoPeopleShipHomePage(result.data.creatorId)
}
}).catch(() => {
ToastUtils.longToast("暂时无法查看该创作者主页")
})
commentViewModel.jumpToAccountPage(this.item)
}
jumpToDetail() {
... ...
import { MasterDetailRes } from 'wdBean/Index';
import { SpConstants } from 'wdConstant/Index';
import { DateTimeUtils, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index';
import {
AccountManagerUtils,
DateTimeUtils, DeviceUtil, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index';
import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import {
commentItemModel,
commentListModel,
... ... @@ -160,7 +164,9 @@ class CommentViewModel {
publishComment(model: publishCommentModel) {
return new Promise<commentItemModel>((success, fail) => {
let url = HttpUrlUtils.getPublishCommentUrl()
const visitorMode = model.visitorComment == "1" && AccountManagerUtils.isLoginSync() == false
let url = visitorMode ? HttpUrlUtils.getNoUserPublishCommentUrl() : HttpUrlUtils.getPublishCommentUrl()
let bean: Record<string, string> = {};
bean['targetId'] = model.targetId;
... ... @@ -176,6 +182,11 @@ class CommentViewModel {
bean['targetType'] = model.targetType
bean['parentId'] = model.parentId
if (visitorMode) {
bean['deviceId'] = DeviceUtil.clientId()
bean['userName'] = SPHelper.default.getSync(SpConstants.TOURIST_NICK_NAME, "") as string
}
HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => {
if (data.code != 0) {
ToastUtils.showToast(data.message, 1000);
... ... @@ -185,10 +196,9 @@ class CommentViewModel {
ToastUtils.showToast(data.message, 1000);
let model = data.data as commentItemModel
let userId = HttpUtils.getUserId()
let FIRSTCOMMENTTIME = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '')
let firstCommentTime = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '') as string
if (!userId && !FIRSTCOMMENTTIME) {
if (visitorMode && firstCommentTime.length == 0) {
//保存首次评论时间
SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, DateTimeUtils.formatDate(data.timestamp, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
}
... ... @@ -472,6 +482,36 @@ class CommentViewModel {
}
return false
}
jumpToAccountPage(commentItem: commentItemModel) {
let url = HttpUrlUtils.getOtherUserDetailDataUrl()
let item : Record<string, string >= {
"creatorId": commentItem.fromCreatorId || "",
"userType": `${commentItem.fromUserType}`,
"userId": commentItem.fromUserId || "-1",
}
HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => {
if (!result.data || result.data.mainControl != 1) {
ToastUtils.longToast("暂时无法查看该创作者主页")
return
}
if (result.data.banControl == 1) {
ToastUtils.longToast("该账号已封禁,不予访问")
return
}
if (result.data.userType === "1") { // 普通用户
let params: Record<string, string> = {'userId': result.data.userId};
WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
} else { // 非普通用户
ProcessUtils.gotoPeopleShipHomePage(result.data.creatorId)
}
}).catch(() => {
ToastUtils.longToast("暂时无法查看该创作者主页")
})
}
}
... ...
import { CompDTO, ContentDTO, } from 'wdBean';
import { BreakpointConstants, CommonConstants, DurationEnum } from 'wdConstant';
import { BreakpointConstants, CommonConstants } from 'wdConstant';
import { BreakPointType, Logger } from 'wdKit';
import { CompUtils } from '../../utils/CompUtils';
import { ProcessUtils } from 'wdRouter';
import { EmptyComponent } from '../view/EmptyComponent';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { Notes } from '../cardview/notes';
const TAG = 'Zh_Carousel_Layout-01';
... ... @@ -40,19 +41,21 @@ class MyDataSource implements IDataSource {
@Component
export struct ZhCarouselLayout01 {
@StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS;
@StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string =
BreakpointConstants.BREAKPOINT_XS;
@State compDTO: CompDTO = {} as CompDTO
private data: MyDataSource = new MyDataSource([])
@State firstWd: number = 0
@State SecondWd: number = 0
@State swiperIndex: number = 0
private data: MyDataSource = new MyDataSource([])
watchCurrentBreakpoint() {
Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`);
}
aboutToAppear() {
Logger.info(TAG, `aboutToAppear, beanList:${this.compDTO?.operDataList?.length}, currentBreakpoint:${this.currentBreakpoint}`);
Logger.info(TAG,
`aboutToAppear, beanList:${this.compDTO?.operDataList?.length}, currentBreakpoint:${this.currentBreakpoint}`);
let list: number[] = []
for (let i = 1; i <= this.compDTO?.operDataList?.length; i++) {
list.push(i);
... ... @@ -155,16 +158,21 @@ export struct ZhCarouselLayout01 {
}
public buildDisplayCount(): number {
return new BreakPointType({ xs: 1, sm: 1, md: 2, lg: 3 }).getValue(this.currentBreakpoint)
return new BreakPointType({
xs: 1,
sm: 1,
md: 2,
lg: 3
}).getValue(this.currentBreakpoint)
}
}
@Component
struct CarouselLayout01CardView {
@State loadImg: boolean = false;
private item: ContentDTO = new ContentDTO();
private length: number = 1; // 轮播图数量
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
... ... @@ -187,22 +195,18 @@ struct CarouselLayout01CardView {
})
Column() {
// 这里用于展示轮播图右上角信息,这里只对直播类型的展示
if (this.item.objectType === '2' || this.item.objectType ==='4') {
if (this.item.objectType === '2' || this.item.objectType === '4') {
CardMediaInfo({ contentDTO: this.item })
.width(CommonConstants.FULL_PARENT)
}
Blank()
// 文本信息
Stack() {
if (this.item.objectType == '5') {
Notes({ objectType: this.item.objectType })
}
Text(`${this.item.corner}${this.item.newsTitle}`)
.width(CommonConstants.FULL_PARENT)
.height(39)
.padding({
left: 10,
right: 10
})
.margin({
bottom: this.length > 1 ? 28 : 10
})
.fontColor(Color.White)
.fontSize($r('app.float.font_size_16'))
.fontWeight(FontWeight.Medium)
... ... @@ -210,12 +214,24 @@ struct CarouselLayout01CardView {
.align(Alignment.Bottom)
.maxLines(CompUtils.MAX_LINES_2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(this.item.objectType == '5' ? 35 : 0)
}
// .height(39)
.padding({
left: 10,
right: 10
})
.margin({
bottom: this.length > 1 ? 28 : 10
})
.alignContent(Alignment.TopStart)
}
.width(CommonConstants.FULL_PARENT)
.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, Params, Action } from 'wdBean';
import { CompDTO, ContentDTO, Params, Action, ReserveItemBean} from 'wdBean';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { postInteractAccentionOperateParams } from 'wdBean';
import { PageRepository } from '../../repository/PageRepository';
... ... @@ -16,11 +16,6 @@ import { SpConstants } from 'wdConstant/Index'
*/
const TAG = 'Zh_Single_Row-03'
interface reserveItem {
liveId: number,
relationId: string,
subscribe: boolean
}
interface reserveReqItem {
liveId: string,
... ... @@ -45,16 +40,18 @@ export struct ZhSingleRow03 {
// 请求所有预约状态
async getReserveState() {
this.reservedIds = []
const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => {
const reqItem: reserveReqItem = {
liveId: item.objectId,
relationId: item.relId
liveId: item.objectId.toString(),
relationId: item.relId.toString()
}
return reqItem;
})
const res = await LiveModel.getAppointmentStatus(reserveBean);
// this.reserveStatus = res;
res.map((item: reserveItem) => {
Logger.debug(TAG, '数据信息:' + `${JSON.stringify(res)}`)
res.map((item: ReserveItemBean) => {
if (item.subscribe) {
this.reservedIds.push(item.liveId.toString())
}
... ...
import { commentInfo, CompDTO, ContentDTO, Params } from 'wdBean';
import { commentInfo, CompDTO, ContentDTO, Params, batchLikeAndCollectResult } from 'wdBean';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { DateTimeUtils, SPHelper } from 'wdKit/Index';
import { DateTimeUtils, SPHelper, Logger } from 'wdKit/Index';
import { ProcessUtils } from 'wdRouter';
import { SpConstants } from 'wdConstant/Index'
import {
batchLikeAndCollectParams,
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
import commentViewModel from '../../components/comment/viewmodel/CommentViewModel';
import { commentItemModel } from '../../components/comment/model/CommentModel'
/**
* 精选评论卡
* Zh_Single_Row-06
*/
const TAG = 'Zh_Single_Row-06'
// interface commentInfo {
// commentTitle: string,
// newsTitle: string,
// userName: string,
// userHeaderUrl: string,
// publishTime: number
// }
// interface operDataListItem {
// commentInfo: commentInfo
// }
// interface CommentData{
// operDataList: Array<operDataListItem>
// }
@Entry
@Component
export struct ZhSingleRow06 {
@State compDTO: CompDTO = {} as CompDTO
@State likeBl: boolean = false;
@State newsStatusOfUser: batchLikeAndCollectResult = {
likeStatus: '0'
} as batchLikeAndCollectResult // 点赞、收藏状态
async likeAction() {
aboutToAppear(): void {
this.getInteractDataStatus()
}
/**
* 点赞、取消点赞
*/
async toggleLikeStatus() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
if (this.likeBl) {
this.likeBl = false;
} else {
this.likeBl = true;
const commentInfo = this.compDTO.operDataList[0]?.commentInfo as commentInfo;
// commentLikeChange(this.item)
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1';
const commentLikeParam = {
targetId: commentInfo.newsId || '',
id: commentInfo.commentId,
targetType: commentInfo?.objectType || '',
api_status: this.newsStatusOfUser?.likeStatus == '1' ? false : true
} as commentItemModel;
commentViewModel.commentLike(commentLikeParam).then(() => {
}).catch(() => {
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1';
})
}
// 已登录->查询用户对作品点赞、收藏状态
async getInteractDataStatus() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
return
}
try {
const params: batchLikeAndCollectParams = {
contentList: [
{
contentId: this.compDTO.operDataList[0]?.commentInfo?.newsId + '',
contentType: this.compDTO.operDataList[0]?.commentInfo?.newsType + '',
}
]
}
let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
Logger.info(TAG, 'ZhSingleRow06-data', JSON.stringify(data))
this.newsStatusOfUser = data[0];
Logger.info(TAG, `ZhSingleRow06-newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
} catch (exception) {
console.error(TAG, JSON.stringify(exception))
}
}
... ... @@ -91,11 +125,11 @@ export struct ZhSingleRow06 {
Row() {
Text(DateTimeUtils.getCommentTime(this.compDTO.operDataList[0]?.commentInfo?.publishTime))
.fontSize(14)
.fontSize(12)
.fontColor(0x999999)
Row(){
Image(this.likeBl ? $r('app.media.icon_like_select') : $r('app.media.icon_like'))
Image(Number(this.newsStatusOfUser?.likeStatus) == 1 ? $r('app.media.icon_like_select') : $r('app.media.icon_like'))
.width(16)
.height(16)
.margin({right: 3})
... ... @@ -103,9 +137,11 @@ export struct ZhSingleRow06 {
Text('点赞')
.fontSize(15)
.fontColor(0x999999)
.onClick(() => {
})
}
.onClick(() => {
this.likeAction()
this.toggleLikeStatus()
})
}
.justifyContent(FlexAlign.SpaceBetween)
... ...
/**
* 直播页面点赞动画
*/
interface animationItem {
x: string | number;
y: string | number;
opacity: number;
name: string;
key: string;
url: Resource
}
@Component
export struct LikeAnimationView {
@State @Watch('countChange') count: number = 0
@State imgList: Resource[] =
[$r('app.media.like_animation_1'), $r('app.media.like_animation_2'), $r('app.media.like_animation_3')]
@State animationList: animationItem[] = []
countChange() {
this.animationList.push({
name: 'xxxx',
x: 0,
y: 0,
opacity: 1,
key: Math.random() + '',
url: this.getRandomUrl()
})
}
getRandomUrl(): Resource {
if (Math.random() >= 0 && Math.random() >= 0.33) {
return this.imgList[0]
} else if (Math.random() >= 0.33 && Math.random() >= 0.66) {
return this.imgList[1]
} else {
return this.imgList[2]
}
}
startAnimation() {
}
stopAnimation() {
}
aboutToAppear(): void {
}
aboutToDisappear(): void {
}
build() {
Stack() {
ForEach(this.animationList, (item: animationItem) => {
Image(item.url)
.width(48)
.height(48)
}, (item: animationItem) => item.key)
}
}
}
\ No newline at end of file
... ...
import lottie, { AnimationSegment } from '@ohos/lottie';
import lottie, { AnimationItem, AnimationSegment } from '@ohos/lottie';
@Component
export struct LottieView {
@Prop name: string = ''
@Prop path: string = ''
@Prop lottieWidth?: number = 30
@Prop lottieHeight?: number = 30
@Prop autoplay?: boolean = false
@Prop loop?: boolean = false
@Prop name: string
@Prop path: string
@Prop lottieWidth: number = 30
@Prop lottieHeight: number = 30
@Prop autoplay: boolean = false
@Prop loop: boolean = false
@Prop initialSegment?: AnimationSegment = [0, 120] // 动画起始帧
@Prop onReady: (animateItem: ESObject) => void // 动画初始化完成事件
@Prop onReady: (animateItem: AnimationItem | null) => void // 动画初始化完成事件
@Prop onComplete?: () => void // 动画完成事件
private politeChickyController: CanvasRenderingContext2D = new CanvasRenderingContext2D(); // CanvasRenderingContext2D对象
private animateItem: ESObject = null; // 初始化loadAnimation接口的返回对象
private politeChickyController: CanvasRenderingContext2D =
new CanvasRenderingContext2D(); // CanvasRenderingContext2D对象
private animateItem: AnimationItem | null = null; // 初始化loadAnimation接口的返回对象
// 页面隐藏销毁动画
onPageHide(): void {
this.animateItem.destroy()
this.animateItem?.destroy()
if (this.onComplete) {
this.animateItem.removeEventListener('complete', this.onComplete)
this.animateItem?.removeEventListener('complete', this.onComplete)
}
}
... ... @@ -44,7 +45,7 @@ export struct LottieView {
// initialSegment: this.initialSegment
})
if (this.initialSegment) {
this.animateItem.initialSegment = this.initialSegment
this.animateItem.segments = this.initialSegment
}
if (this.onComplete) {
... ... @@ -57,7 +58,7 @@ export struct LottieView {
Stack({ alignContent: Alignment.TopStart }) {
Canvas(this.politeChickyController)
.width(this.lottieWidth)
.height(this.lottieHeight)
.height(this.lottieHeight)// .backgroundColor(Color.Black)
.onReady(() => {
this.loadAnimation();
if (this.onReady) {
... ... @@ -65,7 +66,7 @@ export struct LottieView {
}
})
.onClick(() => {
this.animateItem.play()
this.animateItem?.play()
})
}
}
... ...
import MinePageMoreFunctionModel from '../../viewmodel/MinePageMoreFunctionModel'
import { WDRouterRule, WDRouterPage } from 'wdRouter'
import { WDRouterRule, WDRouterPage, ProcessUtils } from 'wdRouter'
import { Params } from 'wdBean';
import { ToastUtils } from 'wdKit/Index';
... ... @@ -77,7 +77,7 @@ export default struct MinePageMoreFunctionUI {
}else if (item.msg == "关于") { // 关于
WDRouterRule.jumpWithPage(WDRouterPage.aboutPage)
}else if (item.msg == "意见反馈") { // 关于
ToastUtils.shortToast("待开发")
ProcessUtils.gotoFeedBackActivity()
}
})
.height('117lpx')
... ...
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[]
... ... @@ -10,30 +14,7 @@ export default struct MinePagePersonFunctionUI {
Grid(){
ForEach(this.personalData,(item:MinePagePersonalFunctionsItem,index:number)=>{
GridItem(){
Row(){
Column(){
Image(item.imgSrc)
.width('46lpx')
.height('46lpx')
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
Text(`${item.msg}`)
.margin({top:'8lpx'})
.height('23lpx')
.fontColor($r('app.color.color_222222'))
.fontSize('23lpx')
}
.alignItems(HorizontalAlign.Center)
.width('100%')
Blank()
.layoutWeight(1)
if(index % 4 < 3 && index != this.personalData.length-1){
Text().backgroundColor($r('app.color.color_222222'))
.opacity(0.1)
.width('2lpx')
.height('29lpx')
}
}
PagePersonFunction({ item: item, noDivider : (index % 4 < 3 && index != this.personalData.length-1) ? false : true})
}.onClick(()=>{
console.log(index+"")
switch (item.msg){
... ... @@ -42,7 +23,8 @@ export default struct MinePagePersonFunctionUI {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}else {
WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage)
let params: Record<string, string> = {'comment': "1"};
WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage,params)
}
break;
}
... ... @@ -83,6 +65,7 @@ export default struct MinePagePersonFunctionUI {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
this.messageClick()
WDRouterRule.jumpWithPage(WDRouterPage.mineMessagePage)
break;
}
... ... @@ -91,11 +74,18 @@ export default struct MinePagePersonFunctionUI {
.height('117lpx')
})
}
// .rowsTemplate('1fr 1fr')
.rowsTemplate('1fr')
.rowsTemplate('1fr 1fr')
.columnsTemplate('1fr 1fr 1fr 1fr')
// .height('234lpx')
.height('167lpx')
.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 MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem'
@Component
export struct PagePersonFunction{
@ObjectLink item: MinePagePersonalFunctionsItem
@State noDivider:boolean = false
build() {
Row(){
Column(){
Stack({ alignContent: Alignment.TopEnd }){
Image(this.item.imgSrc)
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
if (this.item.isShowRedPoint) {
Button()
.type(ButtonType.Circle)
.width("12lpx")
.height("12lpx")
.backgroundColor($r('app.color.color_ED2800'))
}
}.width('46lpx')
.height('46lpx')
Text(`${this.item.msg}`)
.margin({top:'8lpx'})
.height('23lpx')
.fontColor($r('app.color.color_222222'))
.fontSize('23lpx')
}
.alignItems(HorizontalAlign.Center)
.width('100%')
Blank()
.layoutWeight(1)
if(!this.noDivider){
Text().backgroundColor($r('app.color.color_222222'))
.opacity(0.1)
.width('2lpx')
.height('29lpx')
}
}
}
}
\ No newline at end of file
... ...
import { SpConstants } from 'wdConstant/Index'
import { DateTimeUtils, SPHelper, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'
import { SPHelper, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'
import { HttpUtils } from 'wdNetwork/Index'
import { WDRouterRule, WDRouterPage } from 'wdRouter/Index'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
... ... @@ -80,6 +80,7 @@ export struct FollowChildComponent{
}
.justifyContent(FlexAlign.Center)
.width('100lpx')
.backgroundColor($r("app.color.color_F5F5F5"))
.height('46lpx')
.onClick(()=>{
this.followOperation()
... ... @@ -115,9 +116,14 @@ export struct FollowChildComponent{
}.height('202lpx')
.justifyContent(FlexAlign.Start)
Text().backgroundColor($r('app.color.color_EDEDED'))
// Text().backgroundColor($r('app.color.color_EDEDED'))
// .width('100%')
// .height('2lpx')
Divider()
.width('100%')
.height('2lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('1lpx')
}.width('100%')
}else {
... ... @@ -192,6 +198,7 @@ export struct FollowChildComponent{
.fontWeight('500lpx')
.lineHeight('35lpx')
}
.backgroundColor($r("app.color.color_F5F5F5"))
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
... ... @@ -228,9 +235,15 @@ export struct FollowChildComponent{
}.height('146lpx')
.justifyContent(FlexAlign.Center)
Text().backgroundColor($r('app.color.color_EDEDED'))
// Text().backgroundColor($r('app.color.color_EDEDED'))
// .width('100%')
// .height('2lpx')
Divider()
.width('100%')
.height('2lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('1lpx')
}.width('100%')
}
... ... @@ -253,12 +266,6 @@ export struct FollowChildComponent{
this.data.status = this.data.status ==="0"?"1":"0"
UserDataLocal.setUserFollowOperation(this.data.creatorId+","+this.data.status)
// if(this.data.status === "1"){
// UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"")
// }else{
// UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId)
// }
}
}
})
... ...
... ... @@ -30,10 +30,9 @@ export struct HomePageBottomCommentComponent {
build() {
Column() {
if (this.isGetRequest == true) {
Divider().width('100%')
Text().backgroundColor($r('app.color.color_EDEDED'))
.width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
}
if (this.count === 0) {
if (this.isGetRequest == true) {
... ...
... ... @@ -65,10 +65,9 @@ export struct HomePageBottomFollowComponent {
Column() {
if (this.isGetRequest == true) {
Divider().width('100%')
Text().backgroundColor($r('app.color.color_EDEDED'))
.width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
}
if (this.count === 0) {
... ...
... ... @@ -30,10 +30,9 @@ export struct OtherHomePageBottomCommentComponent {
build() {
Column() {
Divider().width('100%')
Text().backgroundColor($r('app.color.color_EDEDED'))
.width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
if (this.count === 0) {
if (this.isGetRequest == true) {
... ...
... ... @@ -30,10 +30,9 @@ export struct OtherHomePageBottomFollowComponent{
build(){
Column(){
Divider().width('100%')
Text().backgroundColor($r('app.color.color_EDEDED'))
.width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
if(this.count === 0){
Column(){
... ...
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
... ...
import { StringUtils, ToastUtils } from 'wdKit/Index'
import { DateTimeUtils, StringUtils, ToastUtils } from 'wdKit/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import { WDMessageCenterMessageType } from '../../../model/InteractMessageModel'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
import { MessageItem } from '../../../viewmodel/MessageItem'
import { CustomTitleUI } from '../../reusable/CustomTitleUI'
import { MessageListItemUI } from './MessageListItemUI'
const TAG = "MessageListUI"
... ... @@ -11,83 +14,149 @@ export struct MessageListUI {
aboutToAppear() {
this.msgData = MinePageDatasModel.getMessageData()
this.getHistoryPush()
this.getMessagePush()
}
build() {
Column() {
//标题栏目
CustomTitleUI({ titleName: "消息" })
//历史推送
getHistoryPush() {
MinePageDatasModel.getHistoryPushData("1", "1").then((value) => {
if (value != null && value.list != null && value.list.length > 0) {
this.msgData.forEach((item) => {
if (item.title == "历史推送") {
if (value.list != null && value.list[0] != null) {
if (value.list[0].newsTitle) {
item.desc = value.list[0].newsTitle
}
if (value.list[0].publishTime) {
item.time = this.getPublishTime("",value.list[0].publishTime)
}
}
}
})
}
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
})
}
List() {
ForEach(this.msgData, (item: MessageItem, index: number) => {
ListItem() {
Column(){
Column() {
Row() {
Row() {
Image(item.imgSrc)
.objectFit(ImageFit.Auto)
.width('92lpx')
.height('92lpx')
.margin({ right: '15lpx' })
//互动消息 预约消息 系统消息
getMessagePush() {
MinePageDatasModel.getMessageUnReadData().then((value) => {
this.msgData.forEach((item) => {
if (item.title == "预约消息") {
if (value.subscribeInfo != null) {
if (value.subscribeInfo.title) {
item.desc = value.subscribeInfo.title
}
if (value.subscribeInfo.time) {
item.time = this.getPublishTime(value.subscribeInfo.time,DateTimeUtils.getDateTimestamp(value.subscribeInfo.time)+"")
}
}
if(value.subscribeCount > 0){
item.unReadCount = value.subscribeCount
}
} else if (item.title == "系统消息") {
if (value.systemInfo != null) {
if (value.systemInfo.title) {
item.desc = value.systemInfo.title
}
if (value.systemInfo.time) {
item.time = this.getPublishTime(value.subscribeInfo.time,DateTimeUtils.getDateTimestamp(value.systemInfo.time) + "")
}
}
if(value.systemCount > 0){
item.unReadCount = value.systemCount
}
}else if(item.title == "互动消息"){
if(value.activeCount > 0){
item.unReadCount = value.activeCount
}
if (value.activeInfo != null) {
if (value.activeInfo.title) {
item.desc = value.activeInfo.title
}
if (value.activeInfo.time) {
item.time = this.getPublishTime(value.subscribeInfo.time,DateTimeUtils.getDateTimestamp(value.activeInfo.time) + "")
}
}
}
})
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
})
}
Column() {
Text(item.title)
.fontWeight(500)
.fontSize('31lpx')
.lineHeight('42lpx')
.fontColor($r('app.color.color_222222'))
.maxLines(1)
.margin({ bottom: StringUtils.isNotEmpty(item.desc)?'8lpx':0 })
getPublishTime(data:string,publishTime: string): string {
const publishTimestamp = parseInt(publishTime)
const currentTime = Date.now(); // 当前时间戳
if(StringUtils.isNotEmpty(item.desc)){
Text(`${item.desc}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.lineHeight('38lpx')
.fontWeight(400)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
}
.height('92lpx')
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
.justifyContent(StringUtils.isNotEmpty(item.desc)?FlexAlign.Start:FlexAlign.Center)
}.layoutWeight(1)
// 计算差异
const timeDifference = currentTime - publishTimestamp;
Row() {
Text(`${item.time}`)
.fontColor($r('app.color.color_999999'))
.fontSize('23lpx')
.fontWeight(500)
.lineHeight('35lpx')
// 转换为分钟、小时和天
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]}`
}
}
}
.justifyContent(FlexAlign.Start)
.alignItems(VerticalAlign.Top)
.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(index != 3 ?Visibility.Visible:Visibility.None)
console.log(result);
return result
}
build() {
Column() {
//标题栏目
CustomTitleUI({ titleName: "消息" })
List() {
ForEach(this.msgData, (item: MessageItem, index: number) => {
ListItem() {
MessageListItemUI({ item: item, index: index })
}
.padding({left:"31lpx",right:"31lpx"})
.padding({ left: "31lpx", right: "31lpx" })
.onClick(() => {
ToastUtils.shortToast(index+"")
switch (index) {
case 0: //互动消息
if(item.unReadCount > 0){
this.sendEnterEvent(WDMessageCenterMessageType.WDMessageCenterMessageType_Interact)
}
WDRouterRule.jumpWithPage(WDRouterPage.interactMessagePage)
break;
case 1: //预约消息
if(item.unReadCount > 0){
this.sendEnterEvent(WDMessageCenterMessageType.WDMessageCenterMessageType_Subscribe)
}
WDRouterRule.jumpWithPage(WDRouterPage.subscribeMessagePage)
break;
case 2: //历史推送
break;
... ... @@ -104,4 +173,12 @@ export struct MessageListUI {
.height('100%')
.width('100%')
}
sendEnterEvent(type:number){
MinePageDatasModel.sendEnterMessageData(type).then((value) => {
console.log(TAG, "消息已读")
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
})
}
}
\ No newline at end of file
... ...
import { SubscribeMessageModel } from '../../../../model/InteractMessageModel'
@Component
export struct SubscribeListChildComponent{
@ObjectLink item: SubscribeMessageModel
build() {
Column(){
Row(){
Text(`${this.item.dealTime}`)
.margin({top:"31lpx",bottom:"23lpx"})
.fontWeight(400)
.fontSize("23lpx")
.lineHeight("33lpx")
.fontColor($r('app.color.color_999999'))
}.width('100%')
.backgroundColor($r('app.color.color_F5F5F5'))
.justifyContent(FlexAlign.Center)
Column(){
Column(){
Text(`${this.item.title}`)
.fontSize("31lpx")
.lineHeight("46lpx")
.fontWeight(500)
.fontColor($r('app.color.color_333333'))
.margin({top:"27lpx",bottom:"25lpx"})
.maxLines(1)
Text().backgroundColor($r('app.color.color_F5F5F5'))
.width('100%')
.height('1lpx')
}.alignItems(HorizontalAlign.Start)
.width("100%")
.height("98lpx")
Row(){
Image(`${this.item.imgUrl}`)
.width('204lpx')
.height('115lpx')
.borderRadius("6lpx")
.objectFit(ImageFit.Auto)
.margin({right:"23lpx"})
Text(`${this.item.desc}`)
.fontSize("27lpx")
.lineHeight("38lpx")
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.layoutWeight(1)
}.alignItems(VerticalAlign.Center)
.width("100%")
.height("160lpx")
Text().backgroundColor($r('app.color.color_F5F5F5'))
.width('100%')
.height('1lpx')
Row(){
Text(`${this.item.time}开始`)
.fontSize("23lpx")
.fontWeight(600)
.lineHeight("31lpx")
Row(){
Text("查看详情")
.fontSize("23lpx")
.lineHeight("38lpx")
.fontWeight(400)
.fontColor($r('app.color.color_666666'))
.margin({right:"8lpx"})
Image($r('app.media.subscribe_arrow_icon'))
.width('23lpx')
.height('13lpx')
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.margin({right:"4lpx"})
}
}.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.SpaceBetween)
.width("100%")
.height("73lpx")
}.backgroundColor($r('app.color.white'))
.borderRadius("8lpx")
.width("100%")
.padding({left:"23lpx",right:"23lpx"})
}
.backgroundColor($r('app.color.color_F5F5F5'))
.width("100%")
.padding({left:"31lpx",right:"31lpx"})
.alignItems(HorizontalAlign.Center)
}
}
\ No newline at end of file
... ...
import { LazyDataSource, StringUtils } from 'wdKit/Index';
import { Remark, SubscribeMessageModel,
WDMessageCenterMessageType } from '../../../../model/InteractMessageModel';
import MinePageDatasModel from '../../../../model/MinePageDatasModel';
import { CustomTitleUI } from '../../../reusable/CustomTitleUI';
import { ListHasNoMoreDataUI } from '../../../reusable/ListHasNoMoreDataUI';
import { EmptyComponent } from '../../../view/EmptyComponent';
import { SubscribeListChildComponent } from './SubscribeListChildComponent';
const TAG = "SubscribeMessageComponent"
@Component
export struct SubscribeMessageComponent{
@State data: LazyDataSource<SubscribeMessageModel> = new LazyDataSource();
@State count: number = 0;
@State isLoading: boolean = false
@State hasMore: boolean = true
curPageNum: number = 1;
@State isGetRequest: boolean = false
aboutToAppear() {
this.getNewPageData()
}
build() {
Column() {
//标题栏目
CustomTitleUI({ titleName: "预约消息" })
if (this.count == 0) {
if (this.isGetRequest == true) {
EmptyComponent({ emptyType: 5 })
.height('100%')
.width('100%')
}
} else {
//刷新控件 TODO
//List
List() {
LazyForEach(this.data, (item: SubscribeMessageModel, index: number) => {
ListItem() {
SubscribeListChildComponent({ item: item })
}.width('100%')
.onClick(() => {
})
})
//没有更多数据 显示提示
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI()
}
}
}.width('100%')
.cachedCount(4)
.scrollBar(BarState.Off)
.layoutWeight(1)
.onReachEnd(() => {
if (!this.isLoading) {
//加载分页数据
this.getNewPageData()
}
})
}
}
.backgroundColor($r('app.color.color_F9F9F9'))
.height('100%')
.width('100%')
}
getNewPageData() {
this.isLoading = true
if (this.hasMore) {
MinePageDatasModel.getSubscribeMessageData(WDMessageCenterMessageType.WDMessageCenterMessageType_Subscribe,"20",`${this.curPageNum}`).then((value) => {
if (!this.data || value.list.length == 0) {
this.hasMore = false
} else {
value.list.forEach((value) => {
let dealTime = this.DealStartTime(value.time,1)
let dealTime2 = this.DealStartTime(value.time,2)
let remark = JSON.parse(value.remark) as Remark
this.data.push(new SubscribeMessageModel(dealTime,value.message,remark.coverImageUrl,value.title,dealTime2,value.contentId))
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.data.totalCount() < value.totalCount) {
this.curPageNum++
} else {
this.hasMore = false
}
}
this.isGetRequest = true
this.isLoading = false
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
this.isGetRequest = true
this.isLoading = false
})
}
}
DealStartTime(planStartTime: string,type:number): string {
let dealData: string = ""
if (StringUtils.isEmpty(planStartTime)) {
console.log(TAG, "格式有误")
return planStartTime
}
if (planStartTime.indexOf(" ") === -1) {
console.log(TAG, "格式有误")
return planStartTime
}
let arr = planStartTime.split(" ")
if (arr != null && StringUtils.isNotEmpty(arr[0])) { //处理年月日
let time = arr[0].split("-");
if (time.length === 3) {
dealData = `${time[1]}-${time[2]}`
if(type === 1){
return dealData
}
}
}
if (arr != null && StringUtils.isNotEmpty(arr[1])) { //处理时分
let time = arr[1].split(":");
if (time.length === 3) {
dealData = `${dealData} ${time[0]}:${time[1]}`
}
}
console.log(TAG, JSON.stringify(dealData))
return dealData
}
}
\ No newline at end of file
... ...
... ... @@ -85,6 +85,7 @@ export struct BottomNavigationComponent {
VideoChannelPage({
topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
_currentNavIndex: $currentNavIndex,
autoRefresh: this.autoRefresh
})
} else {
TopNavigationComponent({
... ...
... ... @@ -7,7 +7,6 @@ import { ErrorComponent } from '../view/ErrorComponent'
import RefreshLayout from './RefreshLayout'
import { RefreshLayoutBean } from './RefreshLayoutBean';
import { CompDTO, ContentDTO } from 'wdBean'
import LoadMoreLayout from './LoadMoreLayout'
import NoMoreLayout from './NoMoreLayout'
import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
import { CustomSelectUI } from '../view/CustomSelectUI';
... ...
... ... @@ -487,12 +487,7 @@ export struct PaperSingleColumn999CardView {
Text(this.getPublishTime())
.fontSize(12)
.fontColor(Color.Gray)
if (this.interactData && this.interactData.commentNum) {
Text(this.interactData.commentNum + "评")
.fontSize(12)
.fontColor(Color.Gray)
.margin({ left: 6 })
}else if (this.commentList && this.commentList.length) {
if (this.interactData && this.interactData.commentNum && Number(this.interactData.collectNum) > 0) {
Text(this.interactData.commentNum + "评")
.fontSize(12)
.fontColor(Color.Gray)
... ... @@ -517,7 +512,7 @@ export struct PaperSingleColumn999CardView {
}
}
.backgroundColor(Color.White)
.margin({ bottom: 14, left: 12, right: 12 })
.margin({ bottom: 10, left: 12, right: 12 })
.borderRadius(4)
.onClick(() => {
ProcessUtils.processPage(this.item)
... ...
... ... @@ -19,19 +19,25 @@ struct EditUserIntroductionPage {
.width('100%')
.height(80)
.backgroundColor(Color.White)
.placeholderColor('#999999')
.onChange(value => {
this.numCount = value.length
if (this.numCount === 60) {
this.textColor = '#ED2800'
}else if(this.numCount === 0){
this.textColor = '#999999'
}else {
this.textColor = '#222222'
}
this.introduction = value
})
Text(this.numCount.toString() + '/60')
Row(){
Text(this.numCount.toString())
.fontColor(this.textColor)
.margin({left: -50})
Text('/60')
.fontColor('#999999')
}.margin({left: -50})
}
.alignItems(VerticalAlign.Bottom)
... ... @@ -42,7 +48,7 @@ struct EditUserIntroductionPage {
Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多60个字,只能输入中文、数字、英文字母。')
.fontSize(13)
.padding(12)
.fontColor(Color.Gray)
.fontColor(Color.Gray).lineHeight(25)
Button('保存')
.type(ButtonType.Normal)
... ...
... ... @@ -22,19 +22,25 @@ struct EditUserNikeNamePage {
.maxLength(16)
.height(50)
.backgroundColor(Color.White)
.placeholderColor('#999999')
.onChange(value => {
this.numCount = value.length
if (this.numCount === 16) {
this.textColor = '#ED2800'
}else if(this.numCount === 0){
this.textColor = '#999999'
}else {
this.textColor = '#222222'
}
this.nikeName = value
})
Text(this.numCount.toString() + '/16')
Row(){
Text(this.numCount.toString())
.fontColor(this.textColor)
.margin({left: -50})
Text('/16')
.fontColor('#999999')
}.margin({left: -50})
}
.alignItems(VerticalAlign.Center)
... ... @@ -44,7 +50,7 @@ struct EditUserNikeNamePage {
Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多16个字,只能输入中文、数字、英文字母。')
.fontSize(13)
.padding(12)
.fontColor(Color.Gray)
.fontColor(Color.Gray).lineHeight(25)
Button('保存')
.type(ButtonType.Normal)
... ...
import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel';
import InteractMessageViewModel from '../../viewmodel/InteractMessageViewModel';
import PageModel from '../../viewmodel/PageModel';
import { CommonConstants, ViewType } from 'wdConstant'
import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent'
import { ContentDTO } from 'wdBean'
import NoMoreLayout from './NoMoreLayout'
import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
import { CustomSelectUI } from '../view/CustomSelectUI';
import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI';
import { BigPicCardComponent } from '../view/BigPicCardComponent';
import { CustomTitleUI } from '../reusable/CustomTitleUI';
import { InteractMComponent } from '../InteractMessage/InteractMComponent';
import { InteractMessageModel, WDMessageCenterMessageType } from '../../model/InteractMessageModel';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
@Entry
... ... @@ -19,20 +15,19 @@ struct InteractMessagePage {
@State private browSingModel: PageModel = new PageModel()
isloading : boolean = false
@Provide isEditState:boolean = false
@State allDatas :ContentDTO[] = [];
@State allDatas :InteractMessageModel[] = [];
private scroller: Scroller = new Scroller();
@State likeNum: number = 20
@State likeNum: number = 0
@State currentPage: number = 1;
aboutToAppear(){
this.getData()
this.getMessageLikeCount()
}
build() {
Column(){
CustomTitleUI({titleName:'互动消息'})
if(this.browSingModel.viewType == ViewType.ERROR){
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed})
}else if(this.browSingModel.viewType == ViewType.EMPTY){
... ... @@ -67,9 +62,9 @@ struct InteractMessagePage {
}
// 下拉刷新
ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => {
ForEach(this.allDatas, (InteractM: InteractMessageModel, compIndex: number) => {
ListItem() {
this.newCompParser(compDTO,compIndex)
InteractMComponent({messageModel:InteractM})
}
})
// 加载更多
... ... @@ -112,32 +107,23 @@ struct InteractMessagePage {
}
@Builder
newCompParser(compDTO: ContentDTO, compIndex: number){
Row(){
if (this.isEditState){
CustomSelectUI({
isOn:compDTO.isSelect,
selectCallback:(isOn)=>{
async getData(resolve?: (value: string | PromiseLike<string>) => void){
InteractMessageViewModel.fetchMessageList(WDMessageCenterMessageType.WDMessageCenterMessageType_Interact,this.currentPage).then(InteractMessageMItem => {
if(resolve) resolve('刷新成功')
if (InteractMessageMItem && InteractMessageMItem.list && InteractMessageMItem.list.length > 0) {
this.browSingModel.viewType = ViewType.LOADED;
}
})
.margin({left:16})
}
Column() {
BigPicCardComponent({contentDTO:compDTO})
}
}
if (this.currentPage === 1) {
this.allDatas = []
}
for (let index = 0; index < InteractMessageMItem.list.length; index++) {
const element = InteractMessageMItem.list[index];
element.InteractMsubM = JSON.parse(element.remark)
}
async getData(resolve?: (value: string | PromiseLike<string>) => void){
MyCollectionViewModel.fetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => {
if(resolve) resolve('刷新成功')
if (collectionItem && collectionItem.list && collectionItem.list.length > 0) {
this.browSingModel.viewType = ViewType.LOADED;
this.allDatas.push(...collectionItem.list)
if (collectionItem.list.length === this.browSingModel.pageSize) {
this.allDatas.push(...InteractMessageMItem.list)
if (InteractMessageMItem.list.length === this.browSingModel.pageSize) {
this.browSingModel.currentPage++;
this.browSingModel.hasMore = true;
} else {
... ... @@ -149,4 +135,11 @@ struct InteractMessagePage {
})
}
async getMessageLikeCount(){
InteractMessageViewModel.getMessageLikeCount().then(num => {
this.likeNum = num
})
}
}
... ...