张善主

Merge remote-tracking branch 'origin/main'

Showing 74 changed files with 1200 additions and 946 deletions

Too many changes to show.

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

... ... @@ -34,6 +34,7 @@ export class SpConstants{
//定位相关
static LOCATION_CITY_NAME = "location_city_name" //定位
static LOCATION_CITY_CODE = "location_city_code" //定位
static LOCATION_PERMISSION_REFUSE = "location_permission_refuse" //定位
//启动页数据存储key
static APP_LAUNCH_PAGE_DATA_MODEL = 'app_launch_page_data_model'
... ...
import { Action } from './Action';
interface dataObject {
// dataSource:
// 1、图文详情数据
... ... @@ -17,7 +18,11 @@ interface dataObject {
webViewHeight?: string
dataJson?: string
appInnerLink?: string
method?: string
url?: string
parameters?: object
}
/**
* 消息Message
*/
... ...
... ... @@ -10,5 +10,7 @@ export enum EmitterEventId {
NETWORK_DISCONNECTED = 3,
// 跳转首页指定频道,事件id
JUMP_HOME_CHANNEL = 4,
LOCATION = 5
}
... ...
... ... @@ -746,7 +746,7 @@ export class HttpUrlUtils {
}
static getSearchHotsDataUrl() {
let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.SEARCH_HOTS_DATA_PATH
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_HOTS_DATA_PATH
return url
}
... ... @@ -847,6 +847,13 @@ export class HttpUrlUtils {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-interact/interact/zh/c/like/executeLike";
return url;
}
//获取点赞状态
static getLikeStatus() {
let url = HttpUrlUtils._hostUrl + "/api/rmrb-interact/interact/zh/c/batchLikeAndCollect/status";
return url;
}
//搜索推荐
static getSearchSuggestDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_SUGGEST_DATA_PATH
... ...
... ... @@ -171,6 +171,17 @@ export class ProcessUtils {
Logger.debug(TAG, `gotoMultiPictureListPage`);
}
public static _gotoSpecialTopic(linkUrl: string) {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
url: linkUrl,
pageID: 'SPACIAL_TOPIC_PAGE',
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
}
public static gotoSpecialTopic(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
... ... @@ -182,6 +193,16 @@ export class ProcessUtils {
WDRouterRule.jumpWithAction(taskAction)
}
public static _gotoDefaultWeb(linkUrl: string) {
let taskAction: Action = {
type: 'JUMP_H5_BY_WEB_VIEW',
params: {
url: linkUrl,
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
}
public static gotoDefaultWeb(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_H5_BY_WEB_VIEW',
... ...
... ... @@ -11,6 +11,7 @@
"wdKit": "file:../wdKit",
"wdJsBridge": "file:../wdJsBridge",
"wdBean": "file:../../features/wdBean",
"wdRouter": "file:../wdRouter"
"wdRouter": "file:../wdRouter",
"wdNetwork": "file:../wdNetwork"
}
}
... ...
... ... @@ -10,6 +10,9 @@ export class H5CallNativeType {
static jsCall_callAppService = 'jsCall_callAppService'
static jsCall_appInnerLinkMethod = 'jsCall_appInnerLinkMethod'
static jsCall_receiveH5Data = 'jsCall_receiveH5Data'
static jsCall_getAppLoginAuthInfo = 'jsCall_getAppLoginAuthInfo'
static jsCall_appNotifyEvent = 'jsCall_appNotifyEvent'
// TODO 业务自行新增类型、自行在JsBridgeBiz#performJSCallNative里添加接收分支处理。
static {
... ... @@ -19,6 +22,8 @@ export class H5CallNativeType {
H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_callAppService)
H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_appInnerLinkMethod)
H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_receiveH5Data)
H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_getAppLoginAuthInfo)
H5CallNativeType.JsCallTypeList.push(H5CallNativeType.jsCall_appNotifyEvent)
}
}
... ...
import HashMap from '@ohos.util.HashMap';
import { Callback } from 'wdJsBridge';
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
import { Logger } from 'wdKit';
... ... @@ -8,6 +9,7 @@ import { ProcessUtils } from 'wdRouter';
import router from '@ohos.router';
import Url from '@ohos.url'
import { ContentDTO } from 'wdBean/Index';
import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork';
const TAG = 'JsBridgeBiz'
... ... @@ -37,7 +39,9 @@ export function performJSCallNative(data: Message, call: Callback) {
case H5CallNativeType.jsCall_getArticleDetailBussinessData:
break;
case H5CallNativeType.jsCall_callAppService:
handleJsCallCallAppService(data)
handleJsCallCallAppService(data, (res: string) => {
call(res)
})
break;
case H5CallNativeType.jsCall_receiveH5Data:
handleJsCallReceiveH5Data(data)
... ... @@ -60,6 +64,21 @@ function handleJsCallCurrentPageOperate(data: Message) {
}
}
function handleJsCallCallAppService(data: Message, callback: (res: string) => void) {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let url: string = HttpUrlUtils.getHost() + data?.data?.url
if (data?.data?.method === 'get') {
WDHttp.get<ResponseDTO<string>>(url, headers).then((res: ResponseDTO<string>) => {
callback(JSON.stringify(res))
})
}
if (data?.data?.method === 'post') {
WDHttp.post<ResponseDTO<string>>(url, data?.data?.parameters, headers).then(res => {
callback(JSON.stringify(res))
})
}
}
/**
* 获取App公共信息
*/
... ... @@ -87,19 +106,14 @@ function handleJsCallReceiveH5Data(data: Message) {
}
}
function handleJsCallCallAppService(data: Message) {
}
function handleJsCallAppInnerLinkMethod(data: Message) {
let urlObject = Url.URL.parseURL(data?.data?.appInnerLink);
let urlParams = new Url.URLParams(urlObject.search);
console.log('urlObject:', `${JSON.stringify(urlParams)}`)
let content: ContentDTO = {
objectId: urlParams.get('contentId') || '',
relId: urlParams.get('relId') || '',
relType: urlParams.get('relType') || '',
pageId:urlParams.get('pageId') || '',
pageId: urlParams.get('pageId') || '',
objectType: ''
} as ContentDTO
if (urlParams.get('skipType') === '1') {
... ... @@ -130,14 +144,14 @@ function handleJsCallAppInnerLinkMethod(data: Message) {
ProcessUtils.processPage(content)
break;
case 'topic':
if(urlParams.get('subType') === 'h5'){
if (urlParams.get('subType') === 'h5') {
content.objectType = ContentConstants.TYPE_SPECIAL_TOPIC
ProcessUtils.processPage(content)
}
if(urlParams.get('subType') === 'moring_evening_news'){
if (urlParams.get('subType') === 'moring_evening_news') {
ProcessUtils.gotoMorningEveningPaper()
}
if(urlParams.get('subType') === 'electronic_newspapers'){
if (urlParams.get('subType') === 'electronic_newspapers') {
ProcessUtils.gotoENewsPaper()
}
break;
... ...
... ... @@ -7,6 +7,7 @@ export interface CompDTO {
cityCode: string;
compStyle: string;
compType: string;
// dataSourceRequest: any[];
districtCode: string;
extraData?: string;
... ... @@ -15,6 +16,7 @@ export interface CompDTO {
imgSize: string;
innerUrl: string;
linkUrl: string;
// meddleDataList: any[];
name: string;
objectId: string; // 跳转页面id?
... ... @@ -29,9 +31,13 @@ export interface CompDTO {
subType: string;
imageScale: number; // 封面图比例 1-4:3, 2-16:9, 3-3:2
audioDataList: AudioDTO[];
titleShowPolicy: string | number;
/**
* 组件内容源类型 (LIVE_HORIZONTAL_CARD\LIVE_RESERVATION\LIVE_LARGE_CARD\LIVE_END\LIVE_MONTHLY_RANKING )
*/
dataSourceType: string;
pageId?: string;
objectType?: string;
}
\ No newline at end of file
... ...
import { RmhInfoDTO } from '../detail/RmhInfoDTO'
export interface LiveDetailsBean {
/**
* {
... ... @@ -164,14 +166,16 @@ export interface LiveDetailsBean {
//迁移id
oldNewsId: string
reLInfo: ReLInfo
rmhInfo: RmhInfo
rmhInfo: RmhInfoDTO
}
export interface LiveInfo {
//直播新闻-直播状态 wait 待开播 running 直播中 end 已结束cancel已取消paused暂停
liveState: string
//2024-04-12 15:00:00 直播开始时间
planStartTime: string
//直播样式 0-正常模式 , 1-隐藏直播间,2-隐藏大家聊 【人民号发布是竖屏的,为空】
liveStyle: number;
vlive: Array<Vlive>
mlive: MLive
... ... @@ -197,11 +201,3 @@ export interface Vlive {
export interface ReLInfo {
relId: string
}
export interface RmhInfo {
rmhName: string;
rmhHeadUrl: string;
rmhId: string;
userId: string;
userType: string;
}
\ No newline at end of file
... ...
... ... @@ -9,6 +9,7 @@ export interface PageInfoDTO {
name: string; // 名称
hasPopUp: number;
baselineShow: number;
baselineCopywriting: string;
groups: GroupInfoDTO[];
channelInfo: ChannelInfoDTO;
... ... @@ -20,11 +21,11 @@ export interface PageInfoDTO {
/**
* 挂角广告数据
*/
cornersAdv:AdvRuleBean
cornersAdv: AdvRuleBean
/**
* 广告中心-挂角广告信息
*/
cornersAdv2:CompAdvBean[]
cornersAdv2: CompAdvBean[]
}
... ...
... ... @@ -14,6 +14,8 @@ export { PageComponent } from "./src/main/ets/components/page/PageComponent"
export { BottomNavigationComponent } from "./src/main/ets/components/page/BottomNavigationComponent"
export { LikeComponent } from "./src/main/ets/components/view/LikeComponent"
export { TopNavigationComponent } from "./src/main/ets/components/page/TopNavigationComponent"
export { LabelComponent } from "./src/main/ets/components/view/LabelComponent"
... ... @@ -77,7 +79,11 @@ export { LiveCommentComponent } from "./src/main/ets/components/comment/view/Liv
export { WDViewDefaultType } from "./src/main/ets/components/view/EmptyComponent"
export { PermissionDesComponent } from "./src/main/ets/components/view/PermissionDesComponent"
export { AudioRowComponent } from "./src/main/ets/components/live/AudioRowComponent"
export { WDLiveViewDefaultType } from "./src/main/ets/components/view/LiveEmptyComponent"
export { LiveFollowComponent } from "./src/main/ets/components/cardCommon/LiveFollowComponent"
... ...
... ... @@ -20,8 +20,8 @@ import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01';
import { CardParser } from './CardParser';
import { LiveHorizontalReservationComponent } from './view/LiveHorizontalReservationComponent';
import { ZhGridLayout02 } from './compview/ZhGridLayout02';
import { Card5Component } from './cardview/Card5Component';
import { Card2Component } from './cardview/Card2Component';
import { Card5Component } from './cardview/Card5Component';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
/**
... ... @@ -71,7 +71,7 @@ export struct CompParser {
ZhSingleRow06({ compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
//头图卡 和comStyle 2相同,
Card5Component({ contentDTO: compDTO.operDataList[0] })
Card5Component({ contentDTO: compDTO.operDataList[0], titleShowPolicy: compDTO.titleShowPolicy })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) {
// 大图卡
Card2Component({ contentDTO: compDTO.operDataList[0] })
... ...
... ... @@ -12,7 +12,7 @@ import {
} from 'wdBean';
import DetailViewModel from '../viewmodel/DetailViewModel';
import { ImageAndTextWebComponent } from './ImageAndTextWebComponent';
import router from '@ohos.router';
import { OperRowListView } from './view/OperRowListView';
import { RecommendList } from '../components/view/RecommendList'
import { CommonConstants } from 'wdConstant';
import { HttpUrlUtils } from 'wdNetwork/Index';
... ... @@ -74,6 +74,45 @@ export struct ImageAndTextPageComponent {
isPageEnd: $isPageEnd
})
Column() {
// 点赞
if (this.contentDetailData[0]?.openLikes) {
// 点赞
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') : $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') : $r('app.media.icon_candle')))
.width(24)
.height(24)
.margin({ right: 5 })
}
Text(`${this.interactData?.likeNum || 0}`)
.fontSize(16)
.fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')
.fontWeight(500)
}
.width(140)
.height(36)
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.borderRadius(20)
.border({
width: 1,
color: '#EDEDED',
})
.onClick(() => {
this.toggleLikeStatus()
})
}.width(CommonConstants.FULL_WIDTH).height(80)
.justifyContent(FlexAlign.Center)
Divider().strokeWidth(6).color('#f5f5f5')
}
if (this.recommendList.length > 0) {
RecommendList({ recommendList: this.recommendList })
}
... ... @@ -91,42 +130,7 @@ export struct ImageAndTextPageComponent {
}
//底部交互区
Row() {
Image($r('app.media.icon_arrow_left'))
.width(24)
.height(24)
.onClick((event: ClickEvent) => {
router.back()
})
Row() {
Image($r('app.media.icon_comment'))
.width(24)
.height(24)
.margin({ right: 24 })
.id('comment')
Image($r('app.media.icon_star'))
.width(24)
.height(24)
.margin({ right: 24 })
Image($r('app.media.icon_listen'))
.width(24)
.height(24)
.margin({ right: 24 })
Image($r('app.media.icon_forward'))
.width(24)
.height(24)
}
}
.width(CommonConstants.FULL_WIDTH)
.height(56)
.padding({ left: 15, right: 15, bottom: 50, top: 20 })
.justifyContent(FlexAlign.SpaceBetween)
.backgroundColor(Color.White)
OperRowListView({ contentDetailData: this.contentDetailData[0] })
}
}
... ...
... ... @@ -6,7 +6,8 @@ import {
H5ReceiveDetailBean,
ResponseBean
} from 'wdBean';
import { Logger } from 'wdKit';
import { Logger, SPHelper, NetworkUtil } from 'wdKit';
import { SpConstants } from 'wdConstant';
import { WdWebLocalComponent } from 'wdWebComponent';
import { NativeCallH5Type } from 'wdWebComponent/src/main/ets/pages/NativeCallH5Type';
import { BridgeWebViewControl } from 'wdJsBridge/Index';
... ... @@ -22,7 +23,7 @@ export struct ImageAndTextWebComponent {
private webPrepared = false;
private dataPrepared = false;
onDetailDataUpdated() {
async onDetailDataUpdated() {
if (this.action) {
let contentId: string = ''
let contentType: string = ''
... ... @@ -30,6 +31,8 @@ export struct ImageAndTextWebComponent {
let channelId: string = ''
let compId: string = ''
let sourcePage: string = '5'
let creatorId = await SPHelper.default.get(SpConstants.USER_CREATOR_ID, '') || ''
let isLogin = await SPHelper.default.get(SpConstants.USER_STATUS, '') || '0'
if (this.action.params) {
if (this.action.params.contentID) {
contentId = this.action.params?.contentID
... ... @@ -56,9 +59,9 @@ export struct ImageAndTextWebComponent {
// TODO 对接user信息、登录情况
let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = {
creatorId: '',
isLogin: '0',
networkStatus: 1,
creatorId: creatorId,
isLogin: isLogin,
networkStatus: Number(NetworkUtil.isNetConnected()),
loadImageOnlyWifiSwitch: '2',
} as H5ReceiveDataExtraBean
... ...
/**
* 直播详情 关注相关信息
*/
import {
ContentDetailRequest,
postInteractAccentionOperateParams
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { postBatchAttentionStatusParams, RmhInfoDTO } from 'wdBean/Index';
import { SpConstants } from 'wdConstant/Index';
import { Logger, SPHelper } from 'wdKit/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
const TAG = 'LiveFollowComponent'
@Component
export struct LiveFollowComponent {
@Prop rmhInfo: RmhInfoDTO
aboutToAppear(): void {
this.getBatchAttentionStatus()
}
/**
* 默认未关注 点击去关注
*/
@State followStatus: String = '0';
build() {
Stack() {
Stack()
.height(22)
.width(130)
.backgroundColor('#000000')
.opacity(0.3)
.borderRadius({
topLeft: 90,
bottomLeft: 90
})
Row() {
Image(this.rmhInfo.rmhHeadUrl)
.width(24)
.height(24)
.borderRadius(90)
Text(this.rmhInfo.rmhName)
.fontColor(Color.White)
.maxLines(1)
.fontWeight(500)
.fontSize('12fp')
.layoutWeight(1)
.margin({
left: 4,
right: 6
})
Blank()
Text(this.followStatus === '0' ? '关注' : '已关注')
.fontColor(Color.White)
.fontWeight(500)
.fontSize('10fp')
.padding({
left: 8,
right: 8,
top: 3,
bottom: 3
})
.borderRadius(2)
.margin({ right: 2 })
.backgroundColor(this.followStatus === '0' ? $r('app.color.color_ED2800') : $r('app.color.color_CCCCCC'))
.onClick(() => {
this.handleAccention()
})
}
.height(22)
.width(130)
}
}
/**
* 查询当前登录用户是否关注作品号主
* */
private async getBatchAttentionStatus() {
try {
const params: postBatchAttentionStatusParams = {
creatorIds: [{ creatorId: this.rmhInfo?.rmhId ?? '' }]
}
let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
this.followStatus = data[0]?.status;
Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)
} catch (exception) {
}
}
/**
* 关注号主
*/
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('关注号主==', JSON.stringify(res.data))
if (this.followStatus == '1') {
this.followStatus = '0'
} else {
this.followStatus = '1'
}
})
}
}
\ No newline at end of file
... ...
... ... @@ -20,6 +20,7 @@ export struct Card5Component {
// newsTitle: '今天是周日,天气阴天,明天是周一。',
// objectType: '6'
} as ContentDTO;
@State titleShowPolicy: number | string = 1
build() {
Stack() {
... ... @@ -27,7 +28,7 @@ export struct Card5Component {
.width(CommonConstants.FULL_WIDTH)
.autoResize(true)
.borderRadius($r('app.float.image_border_radius'))
if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) {
if (this.titleShowPolicy === 1 && this.contentDTO.newsTitle) {
Row()
.width(CommonConstants.FULL_WIDTH)
.height(59)
... ...
... ... @@ -87,6 +87,10 @@ export class commentItemModel {
maxLine: number = 3
/*是否有展示更多*/
hasMore: boolean = false
/*展开子评论的状态下是否有展开更多*/
childsHasMore: boolean = false
/*子评论pageNum*/
pageNum:number = 1
/*当有展示更多的时候,当前的状态是展开还是收起*/
expanded: boolean = false
/*是否正在加载子评论*/
... ...
@Observed
export class publishCommentModel {
/*被评论的内容id*/
//页面必传
/*被评论的内容id 页面必传*/
targetId: string = ""
/*被评论的内容关系id*/
/*被评论的内容关系id 页面必传*/
targetRelId: string = ""
/*1.文字 2.文字+表情 3.定制表情(客户端写死) 4.图片*/
commentType: string = '1'
/*根评论id,如果是一级评论,传-1;否则,传当前评论所属的根评论id*/
rootCommentId: string = "-1"
/*【迭代二新增】内容的标题,取bff内容详情接口中newsTitle字段*/
/*【迭代二新增】内容的标题,取bff内容详情接口中newsTitle字段 页面必传*/
targetTitle: string = ""
/*被评论的内容关系类型,1.频道关系;2.专题关系;【人民号内容为空】默认0*/
/*被评论的内容关系类型,1.频道关系;2.专题关系;【人民号内容为空】默认0 页面必传*/
targetRelType: string = ''
/*【迭代二新增】关联的频道id/专题id;*/
/*【迭代二新增】关联的频道id/专题id; 页面必传*/
targetRelObjectId: string = ""
/*【迭代二新增】是否是重点稿件 1是 0否 页面必传*/
keyArticle: string = ''
/*内容类别, 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14:动态(13和14为中文版新增) 页面必传*/
targetType: string = ''
/*评论总数*/
totalCommentNumer: string = ''
//评论传参
/*评论图片url,多个逗号隔开*/
commentPics: string = ""
/*评论内容*/
commentContent: string = ""
/*【迭代二新增】是否是重点稿件 1是 0否*/
keyArticle: string = ''
/*内容类别, 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14:动态(13和14为中文版新增)*/
targetType: string = ''
/*1.文字 2.文字+表情 3.定制表情(客户端写死) 4.图片*/
commentType: string = '1'
/*根评论id,如果是一级评论,传-1;否则,传当前评论所属的根评论id*/
rootCommentId: string = "-1"
/*父评论id,如果是其它评论的回复,该字段必填*/
parentId: string = "-1"
//可选
placeHolderText: string = "优质评论会获得最佳评论人的称号"
}
... ...
... ... @@ -12,36 +12,37 @@ import { ifaa } from '@kit.OnlineAuthenticationKit';
const TAG = 'CommentComponent';
const testString = '因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸'
// @Entry
@Preview
@Component
export struct CommentComponent {
@State contentId: string = '30004266013'
/*内容类别, 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14:动态(13和14为中文版新增)*/
@State contentType: string = '8'
/*内容的标题,取bff内容详情接口中newsTitle字段*/
@State targetTitle: string = '北约同意向乌克兰提供防空系统在内的更多军事支持'
/*被评论的内容关系id*/
@State targetRelId: string = "500002849023"
/*关联的频道id/专题id*/
@State targetRelObjectId: string = "2002"
/*是否是重点稿件 1是 0否*/
@State keyArticle: string = "0"
/*被评论的内容关系类型,1.频道关系;2.专题关系;【人民号内容为空】默认0*/
@State targetRelType: string = "1"
// @State private browSingModel: commentListModel = new commentListModel()
/*必传*/
@ObjectLink publishCommentModel: publishCommentModel
isloading: boolean = false
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State dialogController: CustomDialogController | null = new CustomDialogController({
@State dialogController: CustomDialogController | null = null;
// 在自定义组件即将析构销毁时将dialogControlle置空
aboutToDisappear() {
this.dialogController = null // 将dialogController置空
}
aboutToAppear() {
this.dialogController = new CustomDialogController({
builder: CommentCustomDialog({
confirm: (value: Record<string, string>) => {
this.publishComment(value)
},
commentText: this.publishCommentModel.commentContent,
placeHolderText: this.publishCommentModel.placeHolderText,
publishCommentModel:this.publishCommentModel
}),
autoCancel: true,
alignment: DialogAlignment.Bottom,
... ... @@ -52,20 +53,6 @@ export struct CommentComponent {
},
})
// 在自定义组件即将析构销毁时将dialogControlle置空
aboutToDisappear() {
this.dialogController = null // 将dialogController置空
}
aboutToAppear() {
this.publishCommentModel.targetTitle = this.targetTitle
this.publishCommentModel.targetId = this.contentId
this.publishCommentModel.targetType = this.contentType
this.publishCommentModel.targetRelId = this.targetRelId
this.publishCommentModel.targetRelType = this.targetRelType
this.publishCommentModel.targetRelObjectId = this.targetRelObjectId
this.publishCommentModel.keyArticle = this.keyArticle
this.getData();
}
... ... @@ -105,7 +92,7 @@ export struct CommentComponent {
/*查看更多和收起*/
@Builder
GroupFooterView(item: commentItemModel, index: number) {
footerExpandedView({ item: item, contentId: this.contentId, contentType: this.contentType })
footerExpandedView({ item: item, contentId: this.publishCommentModel.targetId, contentType: this.publishCommentModel.targetType })
}
build() {
... ... @@ -152,13 +139,13 @@ export struct CommentComponent {
//获取数据
async getData() {
commentViewModel.fetchContentCommentList('1', this.contentId, this.contentType).then(commentListModel => {
commentViewModel.fetchContentCommentList('1', this.publishCommentModel.targetId, this.publishCommentModel.targetType).then(commentListModel => {
if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {
commentListModel.list.forEach(element => {
element.hasMore = Number.parseInt(element.childCommentNum) ? true : false
let newModel = commentViewModel.deepCopyCommentItemModel(element)
newModel.targetId = this.contentId
newModel.targetType = this.contentType
// newModel.targetId = this.publishCommentModel.targetId
// newModel.targetType = this.publishCommentModel.targetType
this.allDatas.push(newModel)
});
... ... @@ -167,20 +154,6 @@ export struct CommentComponent {
})
}
/*回复评论*/
publishComment(value: Record<string, string>) {
this.publishCommentModel.commentContent = value['commentContent']
this.publishCommentModel.commentType = value['commentType']
commentViewModel.publishComment(this.publishCommentModel).then(() => {
this.publishCommentModel.commentContent = ''
}).catch(() => {
})
}
}
... ... @@ -230,7 +203,7 @@ struct ChildCommentItem {
.fontSize(14)
.fontColor($r('app.color.color_222222'))
.fontWeight(FontWeight.Medium)
.margin({ left: 0 , right:0})
.margin({ left: 0, right: 0 })
/// 暂时不显示 “我” 的标签了
... ... @@ -257,10 +230,12 @@ struct ChildCommentItem {
.margin({ left: 5 });
}
}.margin({ left: 0, right: 16 })
// .backgroundColor(Color.Red)
CommentText({
longMessage: this.item.commentContent,
// longMessage:testString,
maxline: 3,
fontSize: 14,
fontWeight: FontWeight.Regular,
... ... @@ -297,12 +272,27 @@ struct footerExpandedView {
build() {
Row() {
if (this.item.expanded) {
if (this.item.childsHasMore) {
Row() {
Text().backgroundColor($r('app.color.color_EDEDED')).width(24).height(1)
Text('查看更多回复').fontColor($r('app.color.color_222222')).fontSize(14).margin({ left: 6 })
Image($r('app.media.comment_unfold')).width(12).height(12)
}.margin({ left: 53 })
.onClick(() => {
if (this.item.isLoading) {
return
}
this.item.isLoading = true
fetchChildContentCommentList(this.contentId, this.contentType, this.item)
})
}
Row() {
Text('收起').fontColor($r('app.color.color_222222')).fontSize(14)
Image($r('app.media.comment_pickUp')).width(12).height(12)
}.margin({ left: 213 })
}.margin({ left: this.item.childsHasMore ? 32 : 213 })
.onClick(() => {
this.item.expanded = !this.item.expanded
this.item.pageNum = 1
this.item.expanded = false
this.item.childComments = []
this.item.childCommentsLazyDataSource.clear()
})
... ... @@ -317,28 +307,35 @@ struct footerExpandedView {
return
}
this.item.isLoading = true
//load child
commentViewModel.fetchChildContentCommentList('1', this.contentId, this.contentType, this.item.id)
fetchChildContentCommentList(this.contentId, this.contentType, this.item)
})
}
}.height(30)
}
}
function fetchChildContentCommentList(contentId: string, contentType: string, item: commentItemModel) {
commentViewModel.fetchChildContentCommentList(item.pageNum + '', contentId, contentType, item.id)
.then((commentListModel) => {
this.item.isLoading = false
this.item.expanded = !this.item.expanded
item.pageNum = item.pageNum + 1
item.childsHasMore = commentListModel.hasNext > 0 ? true : false
item.isLoading = false
item.expanded = true
commentListModel.list.forEach(element => {
this.item.childComments.push(element)
item.childComments.push(element)
let newModel = commentViewModel.deepCopyCommentItemModel(element)
newModel.targetId = this.contentId
newModel.targetType = this.contentType
newModel.targetId = contentId
newModel.targetType = contentType
this.item.childCommentsLazyDataSource.push(newModel)
item.childCommentsLazyDataSource.push(newModel)
})
}).catch(() => {
this.item.isLoading = false
})
item.isLoading = false
})
}
}.height(30)
}
}
@Component
struct commentHeaderView {
@Link publishCommentModel: publishCommentModel
... ... @@ -411,7 +408,14 @@ struct commentHeaderView {
marginWidth: (59 + 16)
})
.margin({ left: 59, right: 16, top: -5 })
.onClick(() => {
this.publishCommentModel.rootCommentId = this.item.rootCommentId
this.publishCommentModel.parentId = this.item.id
this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':'
if (this.dialogController != null) {
this.dialogController.open()
}
})
commentFooterView({
item: this.item,
... ... @@ -456,7 +460,12 @@ struct commentFooterView {
.fontColor($r('app.color.color_222222'))
.fontSize(12)
.onClick(() => {
//TODO: 回复
this.publishCommentModel.rootCommentId = this.item.rootCommentId
this.publishCommentModel.parentId = this.item.id
this.publishCommentModel.placeHolderText = '回复' + this.item.fromUserName + ':'
if (this.dialogController != null) {
this.dialogController.open()
}
})
}
... ...
... ... @@ -5,27 +5,51 @@ import commentViewModel from '../viewmodel/CommentViewModel'
@Preview
@CustomDialog
export struct CommentCustomDialog {
commentText: string = ''
placeHolderText: string = '优质评论会获得最佳评论人的称号'
@ObjectLink publishCommentModel: publishCommentModel
controller?: CustomDialogController
confirm: (value: Record<string, string>) => void = () => {
}
@State private emojiSwitch: boolean = false
textInputController: TextAreaController = new TextAreaController()
aboutToAppear(): void {
}
publishCommentRequest() {
let bean: Record<string, string> = {};
// this.publishCommentModel.commentContent = this.commentText
//TODO 判断类型
this.publishCommentModel.commentType = '1'
commentViewModel.publishComment(this.publishCommentModel).then(() => {
this.publishCommentModel.commentContent = ''
// this.commentText = ''
if (this.controller != null) {
this.controller.close()
}
this.confirm(bean)
}).catch(() => {
if (this.controller != null) {
this.controller.close()
}
})
}
build() {
Column() {
Row() {
TextArea({
placeholder: this.placeHolderText,
placeholder: this.publishCommentModel.placeHolderText,
controller: this.textInputController,
text: this.commentText
text: this.publishCommentModel.commentContent
})
.height('100%')
.width('100%')
.backgroundColor($r('app.color.color_transparent'))
.onChange(value => {
this.commentText = value;
this.publishCommentModel.commentContent = value;
})
}
.backgroundColor('#F9F9F9')
... ... @@ -68,18 +92,11 @@ export struct CommentCustomDialog {
.textAlign(TextAlign.Center)
.borderRadius(4)
.onClick(() => {
if (this.commentText.length > 0) {
if (this.publishCommentModel.commentContent.length > 0) {
//请求评论接口
//commentType
//commentContent
let bean: Record<string, string> = {};
bean['commentContent'] = this.commentText
//TODO 判断类型
bean['commentType'] = '1'
this.confirm(bean)
if (this.controller != null) {
this.controller.close()
}
this.publishCommentRequest()
}
})
}
... ...
import { publishCommentModel } from '../model/PublishCommentModel'
@Preview
@Component
export struct CommentTabComponent {
@ObjectLink publishCommentModel: publishCommentModel
build() {
}
}
\ No newline at end of file
... ...
... ... @@ -8,6 +8,10 @@ import { MyCommentDataSource } from '../model/MyCommentDataSource'
import { HttpUtils } from 'wdNetwork/src/main/ets/utils/HttpUtils'
import { HttpUrlUtils } from 'wdNetwork/Index'
import PageModel from '../../../viewmodel/PageModel'
import { ErrorComponent } from '../../view/ErrorComponent'
import { EmptyComponent , WDViewDefaultType} from '../../view/EmptyComponent'
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'
import NoMoreLayout from '../../page/NoMoreLayout'
const TAG = 'QualityCommentsComponent';
... ... @@ -16,8 +20,13 @@ const TAG = 'QualityCommentsComponent';
@Component
export struct QualityCommentsComponent {
@State private browSingModel: PageModel = new PageModel()
isloading : boolean = false
//刷新
@State viewType:number = ViewType.LOADING;
@State hasMore: boolean = true;
@State currentPage: number = 1;
private scroller: Scroller = new Scroller();
@State tileOpacity: number = 0;
firstPositionY: number = 0;
... ... @@ -25,7 +34,7 @@ export struct QualityCommentsComponent {
topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
lastWindowColor: string = '#ffffff'
currentWindowColor: string = '#FF4202'
@State allDatas: MyCommentDataSource = new MyCommentDataSource();
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
aboutToDisappear(): void {
... ... @@ -40,14 +49,31 @@ export struct QualityCommentsComponent {
aboutToAppear(): void {
this.fullScreen();
this.getData();
}
getData(resolve?: (value: string | PromiseLike<string>) => void){
commentViewModel.fetchQualityCommentList(this.currentPage + '').then((commentListModel) => {
if(resolve) resolve('刷新成功')
commentViewModel.fetchQualityCommentList('1').then((commentListModel) => {
if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {
if (this.currentPage === 1) {
this.allDatas.clear()
}
commentListModel.list.forEach(element => {
this.allDatas.pushData(commentViewModel.deepCopyCommentItemModel(element))
this.allDatas.push(commentViewModel.deepCopyCommentItemModel(element))
});
} else {
if (commentListModel.hasNext === 0) {
this.hasMore = false;
} else {
this.hasMore = true;
}
} else {
if (this.currentPage === 1) {
this.viewType = ViewType.EMPTY;
}
}
})
}
... ... @@ -151,20 +177,77 @@ export struct QualityCommentsComponent {
build() {
Column() {
Stack({ alignContent: Alignment.Top }) {
Scroll() {
Column() {
Stack() {
this.titleHeader()
this.listLayout()
// if(this.viewType == ViewType.ERROR){
// ErrorComponent()
// }else if(this.viewType == ViewType.EMPTY){
// EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoComment})
// }else {
// CustomPullToRefresh({
// alldata:[],
// scroller:this.scroller,
// customList:()=>{
// // this.listLayout()
// this.testLayout()
// },
// onRefresh:(resolve)=>{
// this.currentPage = 1
// this.getData(resolve)
// },
// onLoadMore:(resolve)=> {
// if (this.hasMore === false) {
// if(resolve) resolve('')
// return
// }
// this.currentPage++
// this.getData(resolve)
// }
// })
// }
List({ space: 12 }) {
}.alignContent(Alignment.Top)
}.backgroundColor(this.currentWindowColor).width('100%')
}
.friction(0.6)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.width('100%')
.height('100%')
this.TabbarTransparent()
this.TabbarNormal()
}
}
}
@Builder
listLayout(){
List({ space: 12, scroller:this.scroller }) {
// ListItemGroup({ header: this.titleHeader() })
LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
ListItem() {
QualityCommentItem({ item: item, index: index }).margin({ left: 12, right: 12 })
}
})
// 加载更多
ListItem() {
if (this.hasMore === false) NoMoreLayout()
}
ListItem() {
}.height(this.bottomSafeHeight)
... ... @@ -172,36 +255,31 @@ export struct QualityCommentsComponent {
.margin({ top: 196 })
.height("100%")
.width("100%")
.edgeEffect(EdgeEffect.Spring)
.edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
// .edgeEffect(EdgeEffect.Spring)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
// .margin({ bottom: this.bottomSafeHeight })
// .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}.alignContent(Alignment.Top)
}.backgroundColor(this.currentWindowColor).width('100%')
}
.friction(0.6)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.width('100%')
.height('100%')
this.TabbarTransparent()
this.TabbarNormal()
@Builder
testLayout(){
List({ space: 12, scroller:this.scroller }){
LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
ListItem() {
// QualityCommentItem({ item: item, index: index }).margin({ left: 12, right: 12 })
}
})
}
}
}
@Component
struct QualityCommentItem {
@ObjectLink item: commentItemModel
... ... @@ -316,10 +394,10 @@ struct QualityCommentItem {
.margin({ left: 3 })
}
}.onClick(() => {
commentViewModel.commnetLikeChange(this.item)
commentLikeChange(this.item)
commentViewModel.commentLike(this.item).then(() => {
}).catch(() => {
commentViewModel.commnetLikeChange(this.item)
commentLikeChange(this.item)
})
})
}
... ... @@ -331,5 +409,24 @@ struct QualityCommentItem {
}
}
function commentLikeChange(item: commentItemModel) {
item.api_status = !item.api_status
//点赞
if (item.api_status) {
if (item.likeNum.length > 0) {
item.likeNum = (Number.parseInt(item.likeNum) + 1) + ''
} else {
item.likeNum = '1'
}
}
//取消点赞
if (!item.api_status) {
item.likeNum = (Number.parseInt(item.likeNum) - 1) + ''
if (Number.parseInt(item.likeNum) <= 0) {
item.likeNum = ''
}
}
}
... ...
... ... @@ -239,7 +239,8 @@ class CommentViewModel {
let promiseArray: Promise<commentStatusListModel | void>[] = [];
//TODO 未登录不用批查
//未登录不用批查
if (HttpUrlUtils.getUserId()){
if (commentIDs.length > 0) {
let promise1 = new Promise<void>((success) => {
// HttpRequest HttpBizUtil
... ... @@ -284,7 +285,7 @@ class CommentViewModel {
})
promiseArray.push(promise1);
}
}
if (fromUserIDs.length > 0) {
let promise2 = new Promise<void>((success) => {
let url = HttpUrlUtils.getBatchUserUrl();
... ... @@ -385,21 +386,7 @@ class CommentViewModel {
}
commnetLikeChange(model: commentItemModel) {
model.api_status = !model.api_status
//点赞
if (model.api_status) {
model.likeNum = (Number.parseInt(model.likeNum) + 1) + ''
}
//取消点赞
if (!model.api_status) {
model.likeNum = (Number.parseInt(model.likeNum) - 1) + ''
if (Number.parseInt(model.likeNum) < 0) {
model.likeNum = '0'
}
}
// return model
}
deepCopyCommentItemModel(model: commentItemModel) {
let newModel = new commentItemModel()
... ...
... ... @@ -65,7 +65,11 @@ export struct ZhGridLayout03 {
}
.width('100%')
.onClick((event: ClickEvent) => {
if (item.objectType === '11') {
ProcessUtils.jumpChannelTab(item.objectId, item.pageId)
} else {
ProcessUtils.processPage(item)
}
})
}
}
... ...
... ... @@ -15,8 +15,14 @@ const TAG = 'Zh_Single_Column-09'
@Component
export struct ZhSingleColumn09 {
@State compDTO: CompDTO = {} as CompDTO
@State list: Array<string> = ['社会', '三个字', '是四个字', '时事', '社会', '三个字', '是四个字', '时事']
@State activeIndexs: Array<number> = []
@State operDataList: ContentDTO[] = this.compDTO?.operDataList || []
@State selfClosed: Boolean = false;
aboutToAppear(): void {
this.operDataList = this.shuffleArray(this.compDTO?.operDataList)
}
getItemWidth(index: number) {
if (index % 4 === 0 || index % 4 === 3) {
... ... @@ -26,12 +32,56 @@ export struct ZhSingleColumn09 {
}
}
shuffleArray(array: ContentDTO[]) {
for(let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
const tempArray = array[i];
array[i] = array[j];
array[j] = tempArray
}
return array
}
build() {
Column() {
//顶部
this.CompHeader(this.compDTO)
Row() {
Column() {
Text('以下是否有您感兴趣?')
.fontSize(18)
.fontColor(0x000000)
.fontWeight(600)
.width('70%')
.margin({bottom: 4})
Text('选中标签,为您推荐更多您感兴趣的内容')
.fontSize(12)
.fontColor(0xB0B0B0)
.margin({bottom: 10})
.width('70%')
}
Button('选好了', { type: ButtonType.Normal, stateEffect: false })
.fontColor(this.activeIndexs.length > 0 ? 0xed2800 : 0xB0B0B0)
.fontSize(14)
.width(62)
.height(26)
.backgroundColor(this.activeIndexs.length > 0 ? 0xfdf0ed : 0xf5f5f5)
// .lineHeight(26)
.borderRadius(4)
.margin({top: -10})
.padding({top: 0, bottom: 0, left: 0, right: 0})
.onClick(() => {
if (this.activeIndexs.length > 0) {
this.selfClosed = true;
}
})
}
.justifyContent(FlexAlign.SpaceBetween)
.width('100%')
Grid() {
ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
ForEach(this.operDataList, (item: ContentDTO, index: number) => {
GridItem() {
Stack({alignContent: Alignment.TopEnd}) {
Image(item.coverUrl)
... ... @@ -73,17 +123,24 @@ export struct ZhSingleColumn09 {
Row() {
Text('换一换')
.fontSize(14)
.fontColor(0xed2800)
.fontColor(this.compDTO?.operDataList.length > 8 ? 0xed2800 : 0xB0B0B0)
.margin({right: 4})
Image($r('app.media.icon_refresh'))
Image(this.compDTO?.operDataList.length > 8 ? $r('app.media.icon_refresh') : $r('app.media.ic_refresh'))
.width(14)
.height(14)
}
.onClick(() => {
if (this.compDTO?.operDataList.length > 8) {
this.operDataList = this.shuffleArray(this.operDataList)
this.activeIndexs = [];
}
})
Image($r("app.media.close_button"))
.width(14)
.height(14)
.onClick(() => {
this.selfClosed = true;
})
}
.height(40)
... ... @@ -98,42 +155,7 @@ export struct ZhSingleColumn09 {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.backgroundColor($r('app.color.white'))
.margin({ bottom: 8 })
}
@Builder
CompHeader(item: CompDTO) {
Row() {
Column() {
Text('以下是否有您感兴趣?')
.fontSize(18)
.fontColor(0x000000)
.fontWeight(600)
.width('70%')
.margin({bottom: 4})
Text('选中标签,为您推荐更多您感兴趣的内容')
.fontSize(12)
.fontColor(0xB0B0B0)
.margin({bottom: 10})
.width('70%')
}
Text('选好了')
.fontColor(0xed2800)
.fontSize(14)
.width(62)
.height(26)
.backgroundColor(0xfdf0ed)
.textAlign(TextAlign.Center)
// .lineHeight(26)
.borderRadius(4)
.margin({top: -10})
}
.justifyContent(FlexAlign.SpaceBetween)
.width('100%')
.visibility(this.selfClosed ? Visibility.None : Visibility.Visible)
}
}
... ...
... ... @@ -70,9 +70,7 @@ export struct ZhSingleRow02 {
.height(14)
.onClick(() => {
// TODO 跳转的页面,定义的入参可能不合理。推荐id: 41
let params: Params = {
pageID: "1"
}
let params = {'index': "1"} as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params)
})
}
... ... @@ -80,10 +78,13 @@ export struct ZhSingleRow02 {
right: $r('app.float.card_comp_pagePadding_lf'),
})
.onClick(() => {
let params: Params = {
pageID: "1"
if (this.compDTO?.objectType === '11') {
ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string)
} else if (this.compDTO?.objectType === '5') {
ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl)
} else if (this.compDTO?.objectType === '6') {
ProcessUtils._gotoDefaultWeb(this.compDTO.linkUrl)
}
WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params)
})
}
.justifyContent(FlexAlign.SpaceBetween)
... ...
... ... @@ -36,6 +36,15 @@ export struct ZhSingleRow04 {
.width(14)
.height(14)
}
.onClick(() => {
if (this.compDTO?.objectType === '11') {
ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string)
} else if (this.compDTO?.objectType === '5') {
ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl)
} else if (this.compDTO?.objectType === '6') {
ProcessUtils._gotoDefaultWeb(this.compDTO.linkUrl)
}
})
}
.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 8, bottom: 8 })
... ...
... ... @@ -83,9 +83,7 @@ export struct ZhSingleRow05 {
.height(14)
.onClick(() => {
// TODO 跳转的页面,定义的入参可能不合理。推荐id: 41
let params: Params = {
pageID: "1"
}
let params = {'index': "1"} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params)
})
}
... ...
import { Logger, StringUtils, UserDataLocal } from 'wdKit'
import { StringUtils, UserDataLocal } from 'wdKit'
import { WDRouterPage, WDRouterRule } from 'wdRouter'
import MinePageDatasModel from '../../model/MinePageDatasModel'
const TAG = "MinePageUserSimpleInfoUI"
... ...
... ... @@ -4,6 +4,8 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { MineAppointmentItem } from '../../../viewmodel/MineAppointmentItem';
import { LazyDataSource, StringUtils } from 'wdKit';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { EmptyComponent } from '../../view/EmptyComponent';
const TAG = "AppointmentListUI"
@Component
... ... @@ -23,7 +25,9 @@ export struct AppointmentListUI{
//标题栏目
CustomTitleUI({titleName:"预约列表"})
if(this.count == 0){
ListHasNoMoreDataUI({style:2})
EmptyComponent({emptyType:10})
.height('100%')
.width('100%')
}else{
//刷新控件 TODO
//List
... ... @@ -84,6 +88,8 @@ export struct AppointmentListUI{
this.hasMore = false
}
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
})
}
this.isLoading = false
... ...
... ... @@ -89,9 +89,7 @@ export struct HomePageBottomComponent{
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'31lpx',bottom:'4lpx'})
.onClick(()=>{
let params: Params = {
pageID: "1"
}
let params = {'index': "1"} as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
})
... ... @@ -128,9 +126,7 @@ export struct HomePageBottomComponent{
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'31lpx',bottom:'4lpx'})
}.onClick(()=>{
let params: Params = {
pageID: "1"
}
let params = {'index': "1"} as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
})
... ...
... ... @@ -51,9 +51,7 @@ export struct OtherHomePageBottomFollowComponent{
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'31lpx',bottom:'4lpx'})
.onClick(()=>{
let params: Params = {
pageID: "1"
}
let params = {'index': "1"} as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
})
... ... @@ -85,9 +83,7 @@ export struct OtherHomePageBottomFollowComponent{
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'31lpx',bottom:'4lpx'})
}.onClick(()=>{
let params: Params = {
pageID: "1"
}
let params = {'index': "1"} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
})
... ...
import { BottomNavi, CommonConstants } from 'wdConstant';
import { BottomNavDTO } from 'wdBean';
import { EmitterEventId, EmitterUtils, Logger } from 'wdKit';
import { DateTimeUtils, EmitterEventId, EmitterUtils, Logger } from 'wdKit';
import { TopNavigationComponent } from './TopNavigationComponent';
import { MinePageComponent } from './MinePageComponent';
import { CompUtils } from '../../utils/CompUtils';
... ... @@ -40,11 +40,10 @@ export struct BottomNavigationComponent {
* Component opacity value: 0.6.
*/
readonly SIXTY_OPACITY: number = 0.6;
// 接收指定频道跳转的参数
@State assignChannel: AssignChannelParam = new AssignChannelParam()
// 用于传参到顶导组件,【不用channelParam,主要是时序问题,需要先底导处理完,再延时触发顶导处理】
@State assignChannel1: AssignChannelParam = new AssignChannelParam()
@State assignChannel: AssignChannelParam = new AssignChannelParam()
// 自动刷新触发(双击tab自动刷新)
@State autoRefresh: number = 0
async aboutToAppear() {
Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`);
let bottomNav = await PageViewModel.getBottomNavData(getContext(this))
... ... @@ -60,8 +59,8 @@ export struct BottomNavigationComponent {
Logger.debug(TAG, 'receiveEvent JUMP_HOME_CHANNEL: ' + str)
if (str) {
// 跳转指定频道场景,传参底导id、频道id
this.assignChannel = JSON.parse(str) as AssignChannelParam
this.changeBottomNav()
let assignChannel = JSON.parse(str) as AssignChannelParam
this.changeBottomNav(assignChannel)
}
})
}
... ... @@ -83,9 +82,11 @@ export struct BottomNavigationComponent {
groupId: navItem.id,
topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
_currentNavIndex: $currentNavIndex,
navIndex: index,
currentBottomNavName: navItem.name,
barBackgroundColor: $barBackgroundColor,
assignChannel: this.assignChannel1
assignChannel: this.assignChannel,
autoRefresh: this.autoRefresh
})
}
... ... @@ -100,11 +101,6 @@ export struct BottomNavigationComponent {
.barMode(BarMode.Fixed)
// TODO:更详细的判断是视频频道
.barBackgroundColor(this.barBackgroundColor)
.onChange((index: number) => {
Logger.info(TAG, `onChange, index: ${index}`);
this.currentNavIndex = index;
// this.onBottomNavigationIndexChange()
})
.backgroundColor(this.barBackgroundColor)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
... ... @@ -141,6 +137,19 @@ export struct BottomNavigationComponent {
}
.height($r('app.float.bottom_navigation_barHeight'))
.hoverEffect(HoverEffect.Highlight)
.onClick(() => {
if (this.currentNavIndex === index) {
// 当前tab,双击事件
this.doubleClick(() => {
Logger.info(TAG, 'tab double click ')
this.autoRefresh++
})
} else {
// 切换tab
this.currentNavIndex = index;
Logger.info(TAG, `onChange, index: ${index}`);
}
})
// .justifyContent(FlexAlign.Center)
// .onClick(() => {
... ... @@ -164,11 +173,11 @@ export struct BottomNavigationComponent {
/**
* 底导id变化,即指定频道跳转场景
*/
changeBottomNav() {
changeBottomNav(assignChannel: AssignChannelParam) {
let index = -1
for (let i = 0; i < this.bottomNavList.length; i++) {
let bottomNavDTO: BottomNavDTO = this.bottomNavList[i]
if (bottomNavDTO.id.toString() === this.assignChannel.bottomNavId) {
if (bottomNavDTO.id.toString() === assignChannel.bottomNavId) {
index = i
break
}
... ... @@ -180,10 +189,27 @@ export struct BottomNavigationComponent {
setTimeout(() => {
// 底导切换后,触发顶导切换
this.assignChannel1 = new AssignChannelParam()
this.assignChannel1.pageId = this.assignChannel.pageId
this.assignChannel1.channelId = this.assignChannel.channelId
this.assignChannel1.bottomNavId = this.assignChannel.bottomNavId
this.assignChannel = new AssignChannelParam()
this.assignChannel.pageId = assignChannel.pageId
this.assignChannel.channelId = assignChannel.channelId
this.assignChannel.bottomNavId = assignChannel.bottomNavId
}, 20)
}
/**
* 双击实现
*/
doubleClickTime: number = 0
/**
* 双击实现
*/
private doubleClick(fun: () => void) {
let now = DateTimeUtils.getTimeStamp()
if (now - this.doubleClickTime < 200) {
fun()
} else {
this.doubleClickTime = now
}
}
}
\ No newline at end of file
... ...
... ... @@ -5,11 +5,11 @@ import router from '@ohos.router';
@Entry
@Component
struct FollowListPage {
@State params:Params = router.getParams() as Params;
@State params:Record<string, string> = router.getParams() as Record<string, string>;
@State curIndex: string = '0';
onPageShow() {
this.curIndex = this.params?.pageID;
this.curIndex = this.params?.['index'];
}
build() {
... ...
... ... @@ -50,7 +50,7 @@ export struct MinePageComponent {
//个人功能数据
this.personalData = MinePageDatasModel.getPersonalFunctionsData()
//创作者功能数据
this.creatorData = MinePageDatasModel.getCreatorFunctionsData()
// this.creatorData = MinePageDatasModel.getCreatorFunctionsData()
//更多功能数据
this.moreData = MinePageDatasModel.getMoreFunctionsData()
}
... ...
/**
* 已到底UI,数据bean封装【page接口返回配置信息:文字、文字颜色】
*/
@Observed
export class NoMoreBean {
text: string = '';
textColor: string = '';
constructor(text: string) {
this.text = text;
}
}
\ No newline at end of file
... ...
import { CommonConstants, ViewType } from 'wdConstant';
import { Logger } from 'wdKit';
import PageViewModel from '../../viewmodel/PageViewModel';
import { EmptyComponent } from '../view/EmptyComponent';
import { ErrorComponent } from '../view/ErrorComponent';
import PageModel from '../../viewmodel/PageModel';
import { listTouchEvent } from '../../utils/PullDownRefresh';
import { autoRefresh, listTouchEvent } from '../../utils/PullDownRefresh';
import RefreshLayout from './RefreshLayout';
import { RefreshLayoutBean } from './RefreshLayoutBean';
import NoMoreLayout from './NoMoreLayout';
import LoadMoreLayout from './LoadMoreLayout';
import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
import { CompParser } from '../CompParser';
import { CompDTO } from 'wdBean';
import PageHelper from '../../viewmodel/PageHelper';
import { channelSkeleton } from '../skeleton/channelSkeleton'
import { ProcessUtils } from 'wdRouter/Index';
import PageAdModel from '../../viewmodel/PageAdvModel';
import PageNoMoreLayout from './PageNoMoreLayout';
import { NoMoreBean } from './NoMoreBean';
const TAG = 'PageComponent';
... ... @@ -27,18 +25,24 @@ export struct PageComponent {
pageId: string = "";
channelId: string = "";
@Link @Watch('onChange') currentTopNavSelectedIndex: number
// 自动刷新通知
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
build() {
Column() {
if (this.pageModel.viewType == ViewType.LOADING) {
// LoadingComponent()
this.LoadingLayout()
} else if (this.pageModel.viewType == ViewType.ERROR) {
ErrorComponent()
} else if (this.pageModel.viewType == ViewType.EMPTY) {
EmptyComponent()
} else {
} else if (this.pageModel.viewType == ViewType.LOADED) {
this.ListLayout()
} else if (this.pageModel.viewType == ViewType.EMPTY) {
//缺省页
EmptyComponent({
emptyType: this.pageModel.emptyType,
emptyButton: true,
retry: () => {
this.getData()
}
})
}
}
.width(CommonConstants.FULL_PARENT)
... ... @@ -65,6 +69,7 @@ export struct PageComponent {
this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
})
}
LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
ListItem() {
Column() {
... ... @@ -83,7 +88,7 @@ export struct PageComponent {
this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight)
})
} else if (!this.pageModel.contentNeedScroll) {
NoMoreLayout()
PageNoMoreLayout({ noMoreBean: new NoMoreBean(this.pageModel.pageInfo.baselineCopywriting) })
}
}
}
... ... @@ -224,6 +229,15 @@ export struct PageComponent {
}
}
onAutoRefresh() {
if (this.navIndex != this.currentTopNavSelectedIndex) {
return
}
// 当前页面,自动刷新数据
Logger.debug(TAG, 'page onAutoRefresh ' + this.autoRefresh)
autoRefresh(this.pageModel, this.pageAdvModel)
}
async getData() {
Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
this.pageModel.pageId = this.pageId;
... ... @@ -231,14 +245,6 @@ export struct PageComponent {
this.pageModel.channelId = this.channelId;
this.pageModel.currentPage = 1;
PageHelper.getInitData(this.pageModel, this.pageAdvModel)
// let pageInfo = await PageViewModel.getPageInfo(this.pageModel.pageId);
// if (pageInfo == null) {
// this.pageModel.viewType = ViewType.EMPTY;
// return;
// }
// this.pageModel.pageInfo = pageInfo;
// this.pageModel.loadStrategy = 1
// PageHelper.parseGroup(this.pageModel)
}
}
... ...
import { RefreshConstants } from '../../utils/RefreshConstants'
import { NoMoreBean } from './NoMoreBean';
/**
* The No more data layout component.
*/
@Component
export default struct PageNoMoreLayout {
@ObjectLink noMoreBean: NoMoreBean;
text: string | Resource = $r('app.string.footer_text')
aboutToAppear(): void {
if (this.noMoreBean && this.noMoreBean.text.length > 0) {
this.text = this.noMoreBean.text
}
}
build() {
Row() {
Text(this.text)
.margin({ left: RefreshConstants.NoMoreLayoutConstant_NORMAL_PADDING })
.fontSize(RefreshConstants.NoMoreLayoutConstant_TITLE_FONT)
.textAlign(TextAlign.Center)
}
.width(RefreshConstants.FULL_WIDTH)
.justifyContent(FlexAlign.Center)
.height(RefreshConstants.CUSTOM_LAYOUT_HEIGHT)
}
}
\ No newline at end of file
... ...
import { Action, CompDTO, Params, TopNavDTO } from 'wdBean';
import { LazyDataSource, Logger, StringUtils } from 'wdKit';
import { CompDTO, TopNavDTO } from 'wdBean';
import { LazyDataSource, Logger } from 'wdKit';
import { ProcessUtils } from 'wdRouter';
import { PageComponent } from './PageComponent';
import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout';
import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent';
import window from '@ohos.window';
import { WindowModel } from 'wdKit';
import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
... ... @@ -51,6 +49,12 @@ export struct TopNavigationComponent {
@State localChannelList: TopNavDTO[] = []
readonly MAX_LINE: number = 1;
@ObjectLink @Watch('onAssignChannelChange') assignChannel: AssignChannelParam
// 底导传递过来的自动刷新通知
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
// 传递给page的自动刷新通知
@State autoRefresh2Page: number = 0
// 当前底导index
@State navIndex: number = 0
//处理新闻tab顶导频道数据
topNavListHandle() {
... ... @@ -201,6 +205,7 @@ export struct TopNavigationComponent {
navIndex: index,
pageId: navItem.pageId + '',
channelId: navItem.channelId + '',
autoRefresh: this.autoRefresh2Page
})
}
}
... ... @@ -311,6 +316,14 @@ export struct TopNavigationComponent {
Logger.info(TAG, `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`);
}
onAutoRefresh() {
if (this.navIndex != this._currentNavIndex) {
return
}
// 通知page刷新
this.autoRefresh2Page++
}
/**
* 频道id变化,即指定频道跳转场景
*/
... ...
... ... @@ -23,6 +23,9 @@ export struct SearchHotsComponent{
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
if(this.searchHotsData.length === 0){
this.searchHotsData.push(new SearchHotContentItem("二十大",0,1))
}
})
}
... ...
... ... @@ -29,6 +29,17 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
.width(14)
.height(14)
}
.visibility(this.compDTO?.objectType === '0' ? Visibility.None : Visibility.Visible)
.onClick(() => {
if (this.compDTO?.objectType === '11') {
ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string)
} else if (this.compDTO?.objectType === '5') {
ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl)
} else if (this.compDTO?.objectType === '6') {
ProcessUtils._gotoDefaultWeb(this.compDTO.linkUrl)
}
})
}.justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 16, right: 16 })
.margin({ top: 8, bottom: 8 })
... ...
import { Logger } from 'wdKit/Index'
import { LikeViewModel } from '../../viewmodel/LikeViewModel'
const TAG = 'LikeComponent';
@Component
export struct LikeComponent {
@State likeStatus: boolean = false
... ... @@ -15,17 +17,12 @@ export struct LikeComponent {
// this.data['title'] = '开创两校交流先河!克罗地亚教育代表团访问同济大学'
// this.data['userHeaderUrl'] = ""
// this.data['channelId'] = "2059" //必须
// this.data['status'] = "1" //必须
// this.data['status'] = "1"
aboutToAppear(): void {
if (this.data) {
Logger.debug("ddd: " + this.data['status'])
if (this.data['status'] == '1') {
this.likeStatus = true
} else {
this.likeStatus = false
}
//获取点赞状态
this.getLikeStatus()
}
}
... ... @@ -41,10 +38,10 @@ export struct LikeComponent {
}
if (this.likeStatus) {
//1
this.executeLike('1')
this.executeLike('0')
} else {
//0
this.executeLike('0')
this.executeLike('1')
}
})
}.width(24).height(24)
... ... @@ -59,4 +56,18 @@ export struct LikeComponent {
this.enableBtn = true
})
}
getLikeStatus() {
this.viewModel.getLikeStatus(this.data).then((data) => {
if (data && data['data'].length && data['data'][0]['likeStatus']) {
this.likeStatus = data['data'][0]['likeStatus']
}else {
this.likeStatus = false
}
}).catch(() => {
this.likeStatus = false
})
}
}
\ No newline at end of file
... ...
... ... @@ -12,6 +12,7 @@ import {
import router from '@ohos.router';
import inputMethod from '@ohos.inputMethod';
import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
import { LikeComponent } from './LikeComponent';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { PageRepository } from '../../repository/PageRepository';
... ... @@ -29,9 +30,11 @@ const TAG = 'OperRowListView';
@Preview
@Component
export struct OperRowListView {
private contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
// private contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@Prop contentDetailData: ContentDetailDTO
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@State likeBean: Record<string, string> = {}
@State operationList: OperationItem[] = [
{
... ... @@ -60,6 +63,20 @@ export struct OperRowListView {
this.getInteractDataStatus()
}
this.queryContentInteractCount()
// 点赞需要数据
// this.data['userName'] = '人民日报网友2kD2xW'
// this.data['contentType'] = '8' //必须
// this.data['title'] = '开创两校交流先河!克罗地亚教育代表团访问同济大学'
// this.data['userHeaderUrl'] = ""
// this.data['channelId'] = "2059" //必须
// this.data['status'] = "1" //必须
this.likeBean['contentId'] = this.contentDetailData.newsId + ''
this.likeBean['userName'] = this.contentDetailData.editorName + ''
this.likeBean['contentType'] = this.contentDetailData.newsType + ''
this.likeBean['title'] = this.contentDetailData.newsTitle + ''
this.likeBean['userHeaderUrl'] = ''
this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
this.likeBean['status'] = ''
}
build() {
... ... @@ -83,7 +100,7 @@ export struct OperRowListView {
.onClick(() => {
router.back();
})
TextInput({placeholder:'说两句...'})
TextInput({placeholder:'说两句11...'})
.placeholderColor('#999999')
.placeholderFont(
{
... ... @@ -112,10 +129,9 @@ export struct OperRowListView {
.width('54.5%')
}
.width('100%')
.height(56)
.height(126)
.backgroundColor(Color.Black)
}
/**
* 组件项
*
... ... @@ -125,7 +141,11 @@ export struct OperRowListView {
buildOperationItem(item: OperationItem, index: number) {
Column() {
if (item.text === '点赞') {
RelativeContainer() {
LikeComponent({
data: this.likeBean
})
/* RelativeContainer() {
Row() {
Image(this.newsStatusOfUser?.likeStatus == '1' ? item.icon_check : item.icon)
.width(24)
... ... @@ -134,6 +154,7 @@ export struct OperRowListView {
.interpolation(ImageInterpolation.High)
.onClick(() => {
this.toggleLikeStatus()
console.log('点赞_111', JSON.stringify(this.contentDetailData))
})
}
.alignRules({
... ... @@ -168,7 +189,7 @@ export struct OperRowListView {
.id(`e_row3_${index}`)
}
}
.id(`e_icon_${index}`)
.id(`e_icon_${index}`)*/
} else if (item.text === '收藏') {
RelativeContainer() {
Row() {
... ...
@Component
export struct PermissionDesComponent {
@State translateY: number = 0
aboutToAppear(): void {
this.startDismiss()
}
build() {
Column() {
Row() {
Image($r('app.media.tips')).width(20).height(20)
Text("权限使用说明").fontColor('#FF222222').fontSize(14)
.fontWeight(FontWeight.Bold)
.margin({left:4})
}.height(26)
Text("用于为你推荐你可能感兴趣的资讯内容及附近的相关信息,以提升浏览体验。不授权该权限不影响App正常使用。")
.fontSize(14)
.fontColor('#666666')
}
.translate({ y: this.translateY })
.animation({
duration: 400,
curve: Curve.Linear,
})
.alignItems(HorizontalAlign.Start)
.width('90%')
// .height(60)
.backgroundColor('#FFFFFF')
.border({ radius: 5 })
.margin({ top: 12 })
.padding(12)
}
startDismiss() {
setTimeout(() => {
this.translateY = -250
}, 4000)
}
}
\ No newline at end of file
... ...
import { HashMap } from '@kit.ArkTS';
import { Logger } from 'wdKit/Index';
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index';
import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
export class LikeModel {
... ... @@ -8,7 +8,7 @@ export class LikeModel {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<object>((success, fail) => {
HttpRequest.post<ResponseDTO<object>>(HttpUrlUtils.executeLike(), data, headers).then((data: ResponseDTO<object>) => {
HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.executeLike(), data, headers).then((data: ResponseDTO<object>) => {
if (data.code != 0) {
fail(data.message)
return
... ... @@ -20,4 +20,28 @@ export class LikeModel {
})
})
}
getLikeStatus(data: Record<string, string>) {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let model : Record<string,Record<string,string>[]> = {}
model['contentList'] = [data]
return new Promise<object>((success, fail) => {
HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.getLikeStatus(), model, headers).then((data: ResponseDTO<object>) => {
if (data.code != 0) {
fail(data.message)
return
}
success(data)
}, (error: Error) => {
fail(error.message)
Logger.debug("LoginViewModel:error ", error.toString())
})
})
}
}
\ No newline at end of file
... ...
... ... @@ -118,7 +118,7 @@ class MinePageDatasModel{
Logger.info(TAG, `getAppointmentList start`);
this.fetchAppointmentListData(pageSize,pageNum).then((navResDTO: ResponseDTO<MineAppointmentListItem>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getAppointmentListDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
... ... @@ -126,22 +126,11 @@ class MinePageDatasModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getAppointmentListDataLocal(context))
error(null)
})
})
}
async getAppointmentListDataLocal(context: Context): Promise<MineAppointmentListItem> {
Logger.info(TAG, `getBottomNavDataMock start`);
let compRes: ResponseDTO<MineAppointmentListItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineAppointmentListItem>>(context,'appointment_list_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`);
return new MineAppointmentListItem()
}
Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 关注频道详情
* @param pageSize
... ... @@ -154,7 +143,7 @@ class MinePageDatasModel{
Logger.info(TAG, `getAppointmentList start`);
this.fetchFollowListDetailData(params).then((navResDTO: ResponseDTO<MineFollowListDetailItem>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getFollowListDetailDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
... ... @@ -162,22 +151,11 @@ class MinePageDatasModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getFollowListDetailDataLocal(context))
error(null)
})
})
}
async getFollowListDetailDataLocal(context: Context): Promise<MineFollowListDetailItem> {
Logger.info(TAG, `getBottomNavDataMock start`);
let compRes: ResponseDTO<MineFollowListDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineFollowListDetailItem>>(context,'follow_list_detail_data_id120.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`);
return new MineFollowListDetailItem()
}
Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
fetchFollowListDetailData(object:FollowListDetailRequestItem) {
let url = HttpUrlUtils.getFollowListDetailDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
... ... @@ -199,7 +177,7 @@ class MinePageDatasModel{
Logger.info(TAG, `getAppointmentList start`);
this.fetchFollowListData().then((navResDTO: ResponseDTO<FollowListItem[]>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getFollowListDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
... ... @@ -207,21 +185,11 @@ class MinePageDatasModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getFollowListDataLocal(context))
error(null)
})
})
}
async getFollowListDataLocal(context: Context): Promise<FollowListItem[]> {
Logger.info(TAG, `getFollowListDataLocal start`);
let compRes: ResponseDTO<FollowListItem[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<FollowListItem[]>>(context,'follow_list_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getFollowListDataLocal compRes is empty`);
return []
}
Logger.info(TAG, `getFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 我的关注列表
... ... @@ -234,7 +202,7 @@ class MinePageDatasModel{
Logger.info(TAG, `getAppointmentList start`);
this.fetchMineDetailFollowListData(params).then((navResDTO: ResponseDTO<MineFollowListItem>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getMineFollowListDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
... ... @@ -242,7 +210,7 @@ class MinePageDatasModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getMineFollowListDataLocal(context))
error(null)
})
})
}
... ... @@ -253,17 +221,6 @@ class MinePageDatasModel{
return WDHttp.get<ResponseDTO<MineFollowListItem>>(url, headers)
};
async getMineFollowListDataLocal(context: Context): Promise<MineFollowListItem> {
Logger.info(TAG, `getMineFollowListDataLocal start`);
let compRes: ResponseDTO<MineFollowListItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineFollowListItem>>(context,'mine_follow_list_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`);
return new MineFollowListItem()
}
Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 查询是否被关注 列表
* @param params
... ... @@ -275,7 +232,7 @@ class MinePageDatasModel{
Logger.info(TAG, `getAppointmentList start`);
this.fetchFollowListStatusData(params).then((navResDTO: ResponseDTO<QueryListIsFollowedItem[]>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getFollowListStatusDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
... ... @@ -283,7 +240,7 @@ class MinePageDatasModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getFollowListStatusDataLocal(context))
error(null)
})
})
}
... ... @@ -294,18 +251,6 @@ class MinePageDatasModel{
return WDHttp.post<ResponseDTO<QueryListIsFollowedItem[]>>(url,object, headers)
};
async getFollowListStatusDataLocal(context: Context): Promise<QueryListIsFollowedItem[]> {
Logger.info(TAG, `getMineFollowListDataLocal start`);
let compRes: ResponseDTO<QueryListIsFollowedItem[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<QueryListIsFollowedItem[]>>(context,'follow_list_id120_isfocus_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`);
return []
}
Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 我的评论列表
* @param params
... ... @@ -317,16 +262,15 @@ class MinePageDatasModel{
Logger.info(TAG, `getAppointmentList start`);
this.fetchMineCommentListData(time,params).then((navResDTO: ResponseDTO<MineCommentListDetailItem>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getMineCommentListDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
let navigationBean = navResDTO.data as MineCommentListDetailItem
success(navigationBean);
// success(this.getMineCommentListDataLocal(context))
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getMineCommentListDataLocal(context))
error(null)
})
})
}
... ... @@ -337,16 +281,6 @@ class MinePageDatasModel{
return WDHttp.get<ResponseDTO<MineCommentListDetailItem>>(url, headers)
};
async getMineCommentListDataLocal(context: Context): Promise<MineCommentListDetailItem> {
Logger.info(TAG, `getMineFollowListDataLocal start`);
let compRes: ResponseDTO<MineCommentListDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineCommentListDetailItem>>(context,'mine_comment_list_data2.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`);
return new MineCommentListDetailItem()
}
Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 个人中心 获取用户等级
... ... @@ -356,7 +290,7 @@ class MinePageDatasModel{
Logger.info(TAG, `getAppointmentList start`);
this.fetchMineUserLevelData().then((navResDTO: ResponseDTO<MineUserLevelItem>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getMineUserLevelDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
... ... @@ -364,7 +298,7 @@ class MinePageDatasModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `fetchMineUserLevelData catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getMineUserLevelDataLocal(context))
error(null)
})
})
}
... ... @@ -376,17 +310,6 @@ class MinePageDatasModel{
return HttpBizUtil.get<ResponseDTO<MineUserLevelItem>>(url, headers)
};
async getMineUserLevelDataLocal(context: Context): Promise<MineUserLevelItem> {
Logger.info(TAG, `getMineUserLevelDataLocal start`);
let compRes: ResponseDTO<MineUserLevelItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineUserLevelItem>>(context,'mine_user_level.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getMineUserLevelDataLocal compRes is empty`);
return new MineUserLevelItem()
}
Logger.info(TAG, `getMineUserLevelDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 个人中心 获取用户详细信息
*/
... ... @@ -395,7 +318,7 @@ class MinePageDatasModel{
Logger.info(TAG, `getAppointmentList start`);
this.fetchMineUserDetailData().then((navResDTO: ResponseDTO<MineUserDetailItem>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getMineUserDetailDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getUserDetailData then,timeStamp:" + navResDTO.timestamp);
... ... @@ -403,7 +326,7 @@ class MinePageDatasModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `fetchMineUserDetailData catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getMineUserDetailDataLocal(context))
error(null)
})
})
}
... ... @@ -415,16 +338,7 @@ class MinePageDatasModel{
return HttpBizUtil.get<ResponseDTO<MineUserDetailItem>>(url, headers)
};
async getMineUserDetailDataLocal(context: Context): Promise<MineUserDetailItem> {
Logger.info(TAG, `getMineUserLevelDataLocal start`);
let compRes: ResponseDTO<MineUserDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineUserDetailItem>>(context,'mine_user_detail.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getMineUserDetailDataLocal compRes is empty`);
return new MineUserDetailItem()
}
Logger.info(TAG, `getMineUserDetailDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 个人中心 获取其他用户详细信息
*/
... ... @@ -433,7 +347,7 @@ class MinePageDatasModel{
Logger.info(TAG, `getAppointmentList start`);
this.fetchOtherUserDetailData(item).then((navResDTO: ResponseDTO<MineUserDetailItem>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getOtherUserDetailDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getUserDetailData then,timeStamp:" + navResDTO.timestamp);
... ... @@ -441,7 +355,7 @@ class MinePageDatasModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `fetchMineUserDetailData catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getOtherUserDetailDataLocal(context))
error(null)
})
})
}
... ... @@ -452,17 +366,6 @@ class MinePageDatasModel{
return WDHttp.post<ResponseDTO<MineUserDetailItem>>(url, item,headers)
};
async getOtherUserDetailDataLocal(context: Context): Promise<MineUserDetailItem> {
Logger.info(TAG, `getMineUserLevelDataLocal start`);
let compRes: ResponseDTO<MineUserDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineUserDetailItem>>(context,'other_user512157124138245_detail.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getMineUserDetailDataLocal compRes is empty`);
return new MineUserDetailItem()
}
Logger.info(TAG, `getMineUserDetailDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 个人中心 获取其他用户等级
*/
... ... @@ -471,7 +374,7 @@ class MinePageDatasModel{
Logger.info(TAG, `getAppointmentList start`);
this.fetchOtherUserLevelData(item).then((navResDTO: ResponseDTO<MineUserLevelItem[]>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getOtherUserLevelDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
... ... @@ -479,11 +382,11 @@ class MinePageDatasModel{
if(navigationBean.length>0 && StringUtils.isNotEmpty(navigationBean[0].levelHead)){
success(navigationBean);
}else{
success(this.getOtherUserLevelDataLocal(context))
error(null)
}
}).catch((err: Error) => {
Logger.error(TAG, `fetchMineUserLevelData catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getOtherUserLevelDataLocal(context))
error(null)
})
})
}
... ... @@ -494,17 +397,6 @@ class MinePageDatasModel{
return WDHttp.post<ResponseDTO<MineUserLevelItem[]>>(url,item, headers)
};
async getOtherUserLevelDataLocal(context: Context): Promise<MineUserLevelItem[]> {
Logger.info(TAG, `getMineUserLevelDataLocal start`);
let compRes: ResponseDTO<MineUserLevelItem[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineUserLevelItem[]>>(context,'other_user512157124138245_level.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getMineUserLevelDataLocal compRes is empty`);
return []
}
Logger.info(TAG, `getMineUserLevelDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 其他用户的评论列表
* @param params
... ... @@ -516,7 +408,7 @@ class MinePageDatasModel{
Logger.info(TAG, `getAppointmentList start`);
this.fetchOtherCommentListData(params).then((navResDTO: ResponseDTO<MineCommentListDetailItem>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getOtherCommentListDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
... ... @@ -524,7 +416,7 @@ class MinePageDatasModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getOtherCommentListDataLocal(context))
error(null)
})
})
}
... ... @@ -535,16 +427,6 @@ class MinePageDatasModel{
return WDHttp.get<ResponseDTO<MineCommentListDetailItem>>(url, headers)
};
async getOtherCommentListDataLocal(context: Context): Promise<MineCommentListDetailItem> {
Logger.info(TAG, `getMineFollowListDataLocal start`);
let compRes: ResponseDTO<MineCommentListDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineCommentListDetailItem>>(context,'other_user512157124138245_comment_list_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`);
return new MineCommentListDetailItem()
}
Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 查询是否点赞了这条评论
... ... @@ -557,7 +439,7 @@ class MinePageDatasModel{
Logger.info(TAG, `getAppointmentList start`);
this.fetchOtherUserCommentLikeStatusData(params).then((navResDTO: ResponseDTO<QueryCommentListIsLikedItem[]>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getOtherUserCommentLikeStatusDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
... ... @@ -565,7 +447,7 @@ class MinePageDatasModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getOtherUserCommentLikeStatusDataLocal(context))
error(null)
})
})
}
... ... @@ -576,17 +458,6 @@ class MinePageDatasModel{
return WDHttp.post<ResponseDTO<QueryCommentListIsLikedItem[]>>(url,object, headers)
};
async getOtherUserCommentLikeStatusDataLocal(context: Context): Promise<QueryCommentListIsLikedItem[]> {
Logger.info(TAG, `getMineFollowListDataLocal start`);
let compRes: ResponseDTO<QueryCommentListIsLikedItem[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<QueryCommentListIsLikedItem[]>>(context,'other_user512157124138245_comment_list_liked_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`);
return []
}
Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 其他用户的关注列表
* @param params
... ... @@ -598,7 +469,7 @@ class MinePageDatasModel{
Logger.info(TAG, `getAppointmentList start`);
this.fetchOtherUserFollowListData(params).then((navResDTO: ResponseDTO<MineFollowListItem>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getOtherUserFollowListDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
... ... @@ -606,7 +477,7 @@ class MinePageDatasModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getOtherUserFollowListDataLocal(context))
error(null)
})
})
}
... ... @@ -617,17 +488,6 @@ class MinePageDatasModel{
return WDHttp.get<ResponseDTO<MineFollowListItem>>(url, headers)
};
async getOtherUserFollowListDataLocal(context: Context): Promise<MineFollowListItem> {
Logger.info(TAG, `getMineFollowListDataLocal start`);
let compRes: ResponseDTO<MineFollowListItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineFollowListItem>>(context,'other_user_follow_list_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`);
return new MineFollowListItem()
}
Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 预约 和取消预约操作
* @param params
... ... @@ -639,14 +499,14 @@ class MinePageDatasModel{
Logger.info(TAG, `getAppointmentList start`);
this.fetchAppointmentOperation(params).then((navResDTO: ResponseDTO) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getAppointmentOperationLocal(context))
error(null)
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
success(navResDTO);
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getAppointmentOperationLocal(context))
error(null)
})
})
}
... ... @@ -657,18 +517,6 @@ class MinePageDatasModel{
return WDHttp.post<ResponseDTO>(url,object, headers)
};
async getAppointmentOperationLocal(context: Context): Promise<ResponseDTO> {
Logger.info(TAG, `getMineFollowListDataLocal start`);
let compRes: ResponseDTO | null = await ResourcesUtils.getResourcesJson<ResponseDTO>(context,'appointment_operation_data.json');
if (!compRes ) {
Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`);
return compRes
}
Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes
}
/**
* 评论点赞操作
* @param params
... ... @@ -680,14 +528,14 @@ class MinePageDatasModel{
Logger.info(TAG, `getAppointmentList start`);
this.fetchCommentLikeOperation(params).then((navResDTO: ResponseDTO) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getCommentLikeOperationLocal(context))
error(null)
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
success(navResDTO);
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getCommentLikeOperationLocal(context))
error(null)
})
})
}
... ... @@ -698,17 +546,6 @@ class MinePageDatasModel{
return WDHttp.post<ResponseDTO>(url,object, headers)
};
async getCommentLikeOperationLocal(context: Context): Promise<ResponseDTO> {
Logger.info(TAG, `getMineFollowListDataLocal start`);
let compRes: ResponseDTO | null = await ResourcesUtils.getResourcesJson<ResponseDTO>(context,'comment_like_operation_data.json');
if (!compRes ) {
Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`);
return compRes
}
Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes
}
/**
* 关注 取消关注 操作
* @param params
... ... @@ -720,14 +557,14 @@ class MinePageDatasModel{
Logger.info(TAG, `getAppointmentList start`);
this.fetchFollowOperation(params).then((navResDTO: ResponseDTO) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getFollowOperationLocal(context))
error(null)
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
success(navResDTO);
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getFollowOperationLocal(context))
error(null)
})
})
}
... ... @@ -738,17 +575,6 @@ class MinePageDatasModel{
return WDHttp.post<ResponseDTO>(url,object, headers)
};
async getFollowOperationLocal(context: Context): Promise<ResponseDTO> {
Logger.info(TAG, `getMineFollowListDataLocal start`);
let compRes: ResponseDTO | null = await ResourcesUtils.getResourcesJson<ResponseDTO>(context,'follow_operation_data.json');
if (!compRes ) {
Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`);
return compRes
}
Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes
}
}
... ...
... ... @@ -100,7 +100,7 @@ class SearcherAboutDataModel{
Logger.info(TAG, `getSearchHintData start`);
this.fetchSearchHintData().then((navResDTO: ResponseDTO<string[]>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getSearchHintDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getSearchHintData then,SearchHintDataResDTO.timeStamp:" + navResDTO.timestamp);
... ... @@ -108,7 +108,7 @@ class SearcherAboutDataModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `fetchSearchHintData catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getSearchHintDataLocal(context))
error(null)
})
})
}
... ... @@ -119,17 +119,6 @@ class SearcherAboutDataModel{
return WDHttp.get<ResponseDTO<string[]>>(url, headers)
};
async getSearchHintDataLocal(context: Context): Promise<string[]> {
Logger.info(TAG, `getSearchHintDataLocal start`);
let compRes: ResponseDTO<string[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<string[]>>(context,'search_hint_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getSearchHintDataLocal compRes is empty`);
return []
}
Logger.info(TAG, `getSearchHintDataLocal compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 搜索主页 热词
... ... @@ -139,7 +128,7 @@ class SearcherAboutDataModel{
Logger.info(TAG, `getSearchHintData start`);
this.fetchSearchHotsData().then((navResDTO: ResponseDTO<SearchHotContentItem[]>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getSearchHotsDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getSearchHotsData then,getSearchHotsData.timeStamp:" + navResDTO.timestamp);
... ... @@ -147,7 +136,7 @@ class SearcherAboutDataModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `getSearchHotsData catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getSearchHotsDataLocal(context))
error(null)
})
})
}
... ... @@ -158,18 +147,6 @@ class SearcherAboutDataModel{
return WDHttp.get<ResponseDTO<SearchHotContentItem[]>>(url, headers)
};
async getSearchHotsDataLocal(context: Context): Promise<SearchHotContentItem[]> {
Logger.info(TAG, `getSearchHotsDataLocal start`);
let compRes: ResponseDTO<SearchHotContentItem[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<SearchHotContentItem[]>>(context,'search_hots_data.json' ,);
if (!compRes || !compRes.data) {
Logger.info(TAG, `getSearchHotsDataLocal compRes is empty`);
return []
}
Logger.info(TAG, `getSearchHotsDataLocal compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 搜索 联想词
*/
... ... @@ -178,7 +155,7 @@ class SearcherAboutDataModel{
Logger.info(TAG, `getSearchHintData start`);
this.fetchRelatedSearchContentData(keyword).then((navResDTO: ResponseDTO<string[]>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getRelatedSearchContentDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getSearchHintData then,SearchHintDataResDTO.timeStamp:" + navResDTO.timestamp);
... ... @@ -186,7 +163,7 @@ class SearcherAboutDataModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `fetchSearchHintData catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getRelatedSearchContentDataLocal(context))
error(null)
})
})
}
... ... @@ -197,17 +174,6 @@ class SearcherAboutDataModel{
return WDHttp.get<ResponseDTO<string[]>>(url, headers)
};
async getRelatedSearchContentDataLocal(context: Context): Promise<string[]> {
Logger.info(TAG, `getSearchHintDataLocal start`);
let compRes: ResponseDTO<string[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<string[]>>(context,'search_related_data_nimen.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getSearchHintDataLocal compRes is empty`);
return []
}
Logger.info(TAG, `getSearchHintDataLocal compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 搜索结果 展示tab数量
*/
... ... @@ -216,7 +182,7 @@ class SearcherAboutDataModel{
Logger.info(TAG, `getSearchResultCountData start`);
this.fetchSearchResultCountData(keyword).then((navResDTO: ResponseDTO<SearchResultCountItem>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getSearchResultCountDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getSearchResultCountData then,SearchHintDataResDTO.timeStamp:" + navResDTO.timestamp);
... ... @@ -224,7 +190,7 @@ class SearcherAboutDataModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `getSearchResultCountData catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getSearchResultCountDataLocal(context))
error(null)
})
})
}
... ... @@ -235,17 +201,6 @@ class SearcherAboutDataModel{
return WDHttp.get<ResponseDTO<SearchResultCountItem>>(url, headers)
};
async getSearchResultCountDataLocal(context: Context): Promise<SearchResultCountItem> {
Logger.info(TAG, `getSearchResultCountDataLocal start`);
let compRes: ResponseDTO<SearchResultCountItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<SearchResultCountItem>>(context,'search_result_count_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getSearchResultCountDataLocal compRes is empty`);
return new SearchResultCountItem()
}
Logger.info(TAG, `getSearchResultCountDataLocal compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 搜索结果 展示列表
*/
... ... @@ -254,7 +209,7 @@ class SearcherAboutDataModel{
Logger.info(TAG, `getSearchResultListData start`);
this.fetchSearchResultListData(pageSize,pageNum,searchType,keyword).then((navResDTO: ResponseDTO<SearchResultContentData>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getSearchResultListDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getSearchResultListData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp);
... ... @@ -262,7 +217,7 @@ class SearcherAboutDataModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `getSearchResultListData catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getSearchResultListDataLocal(context))
error(null)
})
})
}
... ... @@ -273,17 +228,6 @@ class SearcherAboutDataModel{
return WDHttp.get<ResponseDTO<SearchResultContentData>>(url, headers)
};
async getSearchResultListDataLocal(context: Context): Promise<SearchResultContentData> {
Logger.info(TAG, `getSearchResultListDataLocal start`);
let compRes: ResponseDTO<SearchResultContentData> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<SearchResultContentData>>(context,'search_result_list_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getSearchResultListDataLocal compRes is empty`);
return new SearchResultContentData()
}
Logger.info(TAG, `getSearchResultListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 搜索结果 展示列表(交互详情 评论收藏点赞分享数量)
*/
... ... @@ -292,7 +236,7 @@ class SearcherAboutDataModel{
Logger.info(TAG, `getInteractListData start`);
this.fetchInteractListData(data).then((navResDTO: ResponseDTO<InteractDataDTO[]>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getInteractListDataLocal(context))
error(null)
return
}
Logger.info(TAG, "getInteractListData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp);
... ... @@ -300,7 +244,7 @@ class SearcherAboutDataModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `getInteractListData catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getInteractListDataLocal(context))
error(null)
})
})
}
... ... @@ -311,18 +255,6 @@ class SearcherAboutDataModel{
return WDHttp.post<ResponseDTO<InteractDataDTO[]>>(url,data, headers)
};
async getInteractListDataLocal(context: Context): Promise<InteractDataDTO[]> {
Logger.info(TAG, `getInteractListDataLocal start`);
let compRes: ResponseDTO<InteractDataDTO[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<InteractDataDTO[]>>(context,'search_result_interact_list_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getInteractListDataLocal compRes is empty`);
return []
}
Logger.info(TAG, `getInteractListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
/**
* 获取关注详情 列表
*/
... ... @@ -331,7 +263,7 @@ class SearcherAboutDataModel{
Logger.info(TAG, `getCreatorDetailListData start`);
this.fetchCreatorDetailListData(object).then((navResDTO: ResponseDTO<CreatorDetailResponseItem[]>) => {
if (!navResDTO || navResDTO.code != 0) {
success([])
error(null)
return
}
Logger.info(TAG, "getCreatorDetailListData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp);
... ... @@ -339,7 +271,7 @@ class SearcherAboutDataModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `getCreatorDetailListData catch, error.name : ${err.name}, error.message:${err.message}`);
success([])
error(null)
})
})
}
... ... @@ -357,9 +289,8 @@ class SearcherAboutDataModel{
return new Promise<ContentDTO[]>((success, error) => {
Logger.info(TAG, `getSearchSuggestData start`);
this.fetchSearchSuggestData(object).then((navResDTO: ResponseDTO<ContentDTO[]>) => {
if (!navResDTO || navResDTO.code != 0 /*|| navResDTO.data == null*/) {
// success(this.getSearchSuggestDataLocal(context))
success([])
if (!navResDTO || navResDTO.code != 0 ) {
error(null)
return
}
Logger.info(TAG, "getSearchSuggestData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp);
... ... @@ -367,8 +298,7 @@ class SearcherAboutDataModel{
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `getSearchSuggestData catch, error.name : ${err.name}, error.message:${err.message}`);
// success(this.getSearchSuggestDataLocal(context))
success([])
error(null)
})
})
}
... ... @@ -379,20 +309,6 @@ class SearcherAboutDataModel{
return WDHttp.post<ResponseDTO<ContentDTO[]>>(url,object, headers)
};
async getSearchSuggestDataLocal(context: Context): Promise<ContentDTO[]> {
Logger.info(TAG, `getInteractListDataLocal start`);
let compRes: ResponseDTO<ContentDTO[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<ContentDTO[]>>(context,'search_suggest_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getInteractListDataLocal compRes is empty`);
return []
}
Logger.info(TAG, `getInteractListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
}
const searcherAboutDataModel = SearcherAboutDataModel.getInstance()
... ...
... ... @@ -65,9 +65,8 @@ struct MineHomePage {
.height('130lpx')
.objectFit(ImageFit.Cover)
}.onClick(()=>{
let params: Params = {
pageID: "531267787833221"//sit 测试用 512157124138245
}
//TODO 显示头像
let params = {'userId': "531267787833221"} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
}).width('135lpx')
.height('135lpx')
... ...
... ... @@ -11,11 +11,11 @@ const TAG = "OtherNormalUserHomePage"
@Entry
@Component
struct OtherNormalUserHomePage {
@State params:Params = router.getParams() as Params;
@State params:Record<string, string> = router.getParams() as Record<string, string>;
@Watch('change') @State curUserId: string = '-1';
onPageShow() {
this.curUserId = this.params?.pageID;
this.curUserId = this.params?.['userId'];
}
change(){
... ...
import promptAction from '@ohos.promptAction';
import { RefreshConstants as Const, RefreshState } from './RefreshConstants';
import { touchMoveLoadMore, touchUpLoadMore } from './PullUpLoadMore';
import { PageDTO, CompDTO } from 'wdBean';
import PageModel from '../viewmodel/PageModel';
import PageViewModel from '../viewmodel/PageViewModel';
import { DateTimeUtils } from 'wdKit';
import PageHelper from '../viewmodel/PageHelper';
import PageAdModel from '../viewmodel/PageAdvModel';
export function listTouchEvent(pageModel: PageModel,pageAdvModel:PageAdModel, event: TouchEvent) {
export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, event: TouchEvent) {
switch (event.type) {
case TouchType.Down:
pageModel.downY = event.touches[0].y;
... ... @@ -36,7 +32,7 @@ export function listTouchEvent(pageModel: PageModel,pageAdvModel:PageAdModel, ev
}
if ((pageModel.isPullRefreshOperation === true)) {
// Lift your finger and pull down to refresh.
touchUpPullRefresh(pageModel,pageAdvModel);
touchUpPullRefresh(pageModel, pageAdvModel);
} else {
// Fingers up, handle loading more.
touchUpLoadMore(pageModel);
... ... @@ -66,7 +62,7 @@ export function touchMovePullRefresh(pageModel: PageModel, event: TouchEvent) {
}
}
export function touchUpPullRefresh(pageModel: PageModel,pageAdvModel:PageAdModel) {
export function touchUpPullRefresh(pageModel: PageModel, pageAdvModel: PageAdModel) {
if (pageModel.isCanRefresh === true) {
pageModel.offsetY = vp2px(pageModel.pullDownRefreshHeight);
pullRefreshState(pageModel, RefreshState.Refreshing);
... ... @@ -74,38 +70,26 @@ export function touchUpPullRefresh(pageModel: PageModel,pageAdvModel:PageAdModel
setTimeout(() => {
let self: PageModel = pageModel;
let advSelf: PageAdModel = pageAdvModel;
PageHelper.refreshUI(self,advSelf)
// PageViewModel.getPageData(self.bizCopy(2))
// .then((data: PageDTO) => {
// self.timestamp = DateTimeUtils.getTimeStamp().toString()
// if (data == null || data.compList == null || data.compList.length == 0) {
// self.hasMore = false;
// } else {
// if (data.compList.length == self.pageSize) {
// self.currentPage++;
// self.hasMore = true;
// } else {
// self.hasMore = false;
// }
// // 刷新,替换所有数据
// self.compList.replaceAll(...data.compList)
// PageViewModel.getInteractData(data.compList).then((data: CompDTO[]) => {
// // 刷新,替换所有数据
// self.compList.replaceAll(...data)
// self.timestamp = DateTimeUtils.getTimeStamp().toString()
// })
// }
// closeRefresh(self, true);
// }).catch((err: string | Resource) => {
// promptAction.showToast({ message: err });
// closeRefresh(self, false);
// });
PageHelper.refreshUI(self, advSelf)
}, Const.DELAY_TIME);
} else {
closeRefresh(pageModel, false);
}
}
/**
* 自动刷新接口,如首页底导,双击按钮自动刷新
* @param pageModel 页面数据
* @param pageAdvModel 广告数据
*/
export function autoRefresh(pageModel: PageModel, pageAdvModel: PageAdModel) {
pageModel.isVisiblePullDown = true;
pageModel.offsetY = vp2px(pageModel.pullDownRefreshHeight);
pullRefreshState(pageModel, RefreshState.Refreshing);
pageModel.currentPage = 1;
PageHelper.refreshUI(pageModel, pageAdvModel)
}
export function pullRefreshState(pageModel: PageModel, state: number) {
switch (state) {
case RefreshState.DropDown:
... ...
import promptAction from '@ohos.promptAction';
import PageModel from '../viewmodel/PageModel';
import { RefreshConstants as Const } from './RefreshConstants';
import PageViewModel from '../viewmodel/PageViewModel';
import { PageDTO, CompDTO } from 'wdBean';
import { DateTimeUtils } from 'wdKit';
import PageHelper from '../viewmodel/PageHelper';
export function touchMoveLoadMore(model: PageModel, event: TouchEvent) {
... ... @@ -30,29 +26,6 @@ export function touchUpLoadMore(model: PageModel) {
setTimeout(() => {
closeLoadMore(model);
PageHelper.loadMore(self)
// PageViewModel.getPageData(self.bizCopy())
// .then((data: PageDTO) => {
// self.timestamp = DateTimeUtils.getTimeStamp().toString()
// if (data == null || data.compList == null || data.compList.length == 0) {
// self.hasMore = false;
// } else {
// if (data.compList.length == self.pageSize) {
// self.currentPage++;
// self.hasMore = true;
// } else {
// self.hasMore = false;
// }
// let sizeBefore: number = self.compList.size();
// self.compList.push(...data.compList)
// PageViewModel.getInteractData(data.compList).then((data: CompDTO[]) => {
// // 刷新,替换所有数据
// self.compList.updateItems(sizeBefore, data)
// self.timestamp = DateTimeUtils.getTimeStamp().toString()
// })
// }
// }).catch((err: string | Resource) => {
// promptAction.showToast({ message: err });
// })
}, Const.DELAY_TIME);
} else {
closeLoadMore(self);
... ...
... ... @@ -21,6 +21,7 @@ export class LikeViewModel {
this.likeModel.executeLike(bean)
}
//点赞
executeLike2(bean: Record<string, string>) {
return new Promise<object>((success, fail) => {
... ... @@ -32,4 +33,20 @@ export class LikeViewModel {
})
}
//点赞状态
getLikeStatus(bean: Record<string, string>) {
return new Promise<object>((success, fail) => {
this.likeModel.getLikeStatus(bean).then((data) => {
success(data)
}).catch((error: string) => {
fail(error)
})
})
}
}
\ No newline at end of file
... ...
import { PageDTO, CompDTO, PageInfoDTO, ContentDTO } from 'wdBean';
import { CompStyle, ViewType } from 'wdConstant/Index';
import { CollectionUtils, DateTimeUtils, Logger } from 'wdKit';
import { CollectionUtils, DateTimeUtils, Logger, NetworkUtil } from 'wdKit';
import { closeRefresh } from '../utils/PullDownRefresh';
import PageModel from './PageModel';
import PageViewModel from './PageViewModel';
import { promptAction } from '@kit.ArkUI';
import { AdvRuleBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
import PageAdModel from './PageAdvModel';
import { WDViewDefaultType } from '../components/view/EmptyComponent';
const TAG = 'PageHelper';
... ... @@ -14,14 +15,12 @@ const TAG = 'PageHelper';
* 处理返回后的数据
*/
export class PageHelper {
/**
* 刷新数据
*/
async refreshUI(pageModel: PageModel,pageAdvModel:PageAdModel) {
async refreshUI(pageModel: PageModel, pageAdvModel: PageAdModel) {
pageModel.loadStrategy = 2
this.getPageInfo(pageModel,pageAdvModel)
this.getPageInfo(pageModel, pageAdvModel)
}
/**
... ... @@ -36,28 +35,36 @@ export class PageHelper {
/**
* 进页面请求数据
*/
async getInitData(pageModel: PageModel,pageAdvModel:PageAdModel) {
async getInitData(pageModel: PageModel, pageAdvModel: PageAdModel) {
pageModel.loadStrategy = 1
this.getPageInfo(pageModel,pageAdvModel)
let netStatus = NetworkUtil.isNetConnected()
if (netStatus) {
this.getPageInfo(pageModel, pageAdvModel)
} else {
pageModel.viewType = ViewType.EMPTY;
pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork;
}
}
async getPageInfo(pageModel: PageModel,pageAdvModel:PageAdModel) {
getPageInfo(pageModel: PageModel, pageAdvModel: PageAdModel) {
pageModel.currentPage = 1;
let pageInfo = await PageViewModel.getPageInfo(pageModel.pageId);
PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => {
if (pageInfo == null) {
pageModel.viewType = ViewType.EMPTY;
pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoListContent;
return;
}
pageModel.pageInfo = pageInfo;
//解析广告资源
pageAdvModel.analysisAdvSource(pageInfo)
pageAdvModel.analysisAdvSource(pageInfo);
this.parseGroup(pageModel)
}).catch(() => {
pageModel.viewType = ViewType.EMPTY;
pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_ContentFailed;
})
}
async parseGroup(pageModel: PageModel) {
let pageInfo: PageInfoDTO = pageModel.pageInfo
pageModel.groupList = []
... ... @@ -84,6 +91,8 @@ export class PageHelper {
// 没数据,展示空页面
Logger.debug(TAG, 'aboutToAppear, data response page ' + pageModel.pageId + ', comp list is empty.');
pageModel.viewType = ViewType.EMPTY;
pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoListContent;
}
}
... ...
... ... @@ -5,6 +5,7 @@ import { RefreshConstants as Const } from '../utils/RefreshConstants';
import { PageUIReqBean } from '../components/page/bean/PageUIReqBean';
import { GroupInfoDTO, PageInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO';
import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
import { WDViewDefaultType } from '../components/view/EmptyComponent';
/**
* 页面下拉刷新、上拉加载数据bean。
... ... @@ -38,6 +39,7 @@ export default class PageModel {
isVisiblePullUpLoad: boolean = false;
offsetY: number = 0;
viewType: number = ViewType.LOADING;
emptyType: WDViewDefaultType = WDViewDefaultType.WDViewDefaultType_Default
hasMore: boolean = true;
startIndex = 0;
endIndex = 0;
... ...
... ... @@ -6,7 +6,7 @@
},
{
"name": "footer_text",
"value": "已经到底了"
"value": "已显示全部内容"
},
{
"name": "pull_up_load_text",
... ...
... ... @@ -98,7 +98,14 @@ export struct DetailPlayLivePage {
(data) => {
if (data.length > 0) {
if (data[0].liveInfo?.liveState == 'wait') {
//直播样式 0-正常模式 , 1-隐藏直播间,2-隐藏大家聊 【人民号发布是竖屏的,为空】
if (data[0].liveInfo?.liveStyle == 1) {
this.tabs = ['简介', '大家聊']
} else if (data[0].liveInfo?.liveStyle == 2) {
this.tabs = ['简介', '直播间',]
} else {
this.tabs = ['简介', '直播间', '大家聊']
}
} else {
this.tabs = ['直播间', '大家聊']
}
... ...
... ... @@ -4,6 +4,7 @@ import { devicePLSensorManager } from 'wdDetailPlayApi/Index'
import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index'
import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index'
import { DisplayDirection } from 'wdConstant/Index'
import { LiveFollowComponent } from 'wdComponent/Index'
@Component
export struct PlayUIComponent {
... ... @@ -95,7 +96,17 @@ export struct PlayUIComponent {
bottom: 10
})
Row() {
if (this.liveDetailsBean?.rmhInfo) {
LiveFollowComponent({
rmhInfo: this.liveDetailsBean.rmhInfo
})
.margin({
right: 10
})
}
this.getLiveStatusView()
}
}.width('100%')
.padding({
top: 20,
... ...
... ... @@ -23,12 +23,12 @@ export struct DetailPlayShortVideoPage {
@Prop index: number = 0
@Prop @Watch('currentIndexChange') currentIndex: number = 0
@State playerController: WDPlayerController = new WDPlayerController();
@Provide contentDetailData: ContentDetailDTO | undefined = undefined
@Provide interactData: InteractDataDTO | undefined = undefined
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@Provide interactData: InteractDataDTO = {} as InteractDataDTO
@Provide isFullScreen: boolean = false;
@Provide progressVal: number = 0;
@Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2
@Provide newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@Provide newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult // 点赞、收藏状态
@Provide followStatus: string = '0' // 关注状态
@Provide isOpenDetail: boolean = false // 查看详情按钮点击
@Provide isDragging: boolean = false // 拖动时间进度条
... ...
... ... @@ -24,10 +24,8 @@ export struct DetailVideoListPage {
@Provide pageHide: number = -1
@Provide switchVideoStatus: boolean = false
@State data: ContentDetailDTO[] = []
@State testData: string[] = ['111', '222', '333']
@State currentIndex: number = 0
@State interactDataList: InteractDataDTO[] = []
@State isFullScreen: boolean = false
async aboutToAppear(): Promise<void> {
this.openFullScreen()
... ... @@ -41,10 +39,7 @@ export struct DetailVideoListPage {
}
await this.getContentDetail(this.contentId, this.relId, this.relType)
}
await this.queryVideoList()
this.getContentInteract()
console.log(TAG, 'aboutToAppear', JSON.stringify(action.params))
}
... ... @@ -93,9 +88,22 @@ export struct DetailVideoListPage {
contentId: contentId,
relId: relId,
relType: relType
}).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => {
console.error('getContentDetail==', JSON.stringify(resDTO.data))
}).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => {
console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data))
if (resDTO.data) {
const params: contentListParams = {
contentList: [{
contentId: resDTO.data[0].newsId + '',
contentType: resDTO.data[0].newsType
}]
}
// 批量查询内容当前用户点赞、收藏状态
await ContentDetailRequest.getContentInteract(params).then(res => {
if (res.data) {
this.interactDataList = this.interactDataList.concat(res.data)
}
console.log('获取互动点赞等数据===', JSON.stringify(res))
})
this.data.push(resDTO.data[0])
}
})
... ... @@ -108,8 +116,9 @@ export struct DetailVideoListPage {
await ContentDetailRequest.postRecommendVideoList({
pageSize: 5,
refreshCnt: 1
}).then(res => {
}).then(async res => {
if (res.data) {
await this.getContentInteract(res.data)
this.data = this.data.concat(res.data)
console.log('视频列表===', JSON.stringify(res.data))
}
... ... @@ -119,21 +128,21 @@ export struct DetailVideoListPage {
/**
* 批量查询内容当前用户点赞、收藏状态
*/
getContentInteract() {
if (this.data.length > 0) {
async getContentInteract(data: ContentDetailDTO[]) {
if (data.length > 0) {
const params: contentListParams = {
contentList: []
}
this.data.map(item => {
data.map(item => {
params.contentList.push({
contentId: item.newsId + '',
contentType: item.newsType
})
})
// 批量查询内容当前用户点赞、收藏状态
ContentDetailRequest.getContentInteract(params).then(res => {
await ContentDetailRequest.getContentInteract(params).then(res => {
if (res.data) {
this.interactDataList = res.data || []
this.interactDataList = this.interactDataList.concat(res.data)
}
console.log('获取互动点赞等数据===', JSON.stringify(res))
})
... ...
... ... @@ -145,7 +145,7 @@ export struct VideoChannelDetail {
refreshTime: this.refreshTime,
}
await ContentDetailRequest.getRecCompInfo(params).then(res => {
await ContentDetailRequest.getRecCompInfo(params).then(async res => {
this.isRequestError = false
console.log('根据视频频道传参查询视频楼层信息totalCount', res.data?.totalCount + '')
... ... @@ -174,8 +174,8 @@ export struct VideoChannelDetail {
})
}
this.batchContentDetail(list1)
this.getContentInteract(list2)
await this.batchContentDetail(list1, list2)
setTimeout(() => {
this.isMouted = true
}, 500)
... ... @@ -189,11 +189,14 @@ export struct VideoChannelDetail {
/**
* 根据视频楼层信息批量查询视频列表
*/
async batchContentDetail(list: batchContentDetailParams) {
async batchContentDetail(list: batchContentDetailParams, list2: contentListParams) {
if (list.contents.length > 0) {
await ContentDetailRequest.batchContentDetail(list).then(res => {
await ContentDetailRequest.batchContentDetail(list).then(async res => {
if (res.data) {
await this.getContentInteract(list2)
this.data = this.data.concat(res.data)
}
console.log('根据视频楼层信息批量查询视频列表', res.data)
this.data = this.data.concat(res.data as [])
})
}
}
... ... @@ -204,7 +207,9 @@ export struct VideoChannelDetail {
async getContentInteract(list: contentListParams) {
if (list.contentList.length > 0) {
await ContentDetailRequest.getContentInteract(list).then(res => {
this.interactDataList = res.data || []
if (res.data) {
this.interactDataList = this.interactDataList.concat(res.data)
}
console.log('根据视频信息批量查询点赞、收藏状态', res.data)
})
}
... ...
import { ContentDetailDTO, InteractDataDTO, Params, RmhInfoDTO, UserInfoDTO } from 'wdBean/Index';
import { ContentDetailDTO, InteractDataDTO, Params, } from 'wdBean/Index';
import {
batchLikeAndCollectParams,
batchLikeAndCollectResult,
ContentDetailRequest,
contentListParams,
... ... @@ -8,23 +7,15 @@ import {
postExecuteLikeParams,
postInteractAccentionOperateParams
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { SPHelper, ToastUtils } from 'wdKit';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { SPHelper, ToastUtils, NumberFormatterUtils } from 'wdKit';
import { WDPlayerController } from 'wdPlayer/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { SpConstants } from 'wdConstant/Index'
//视频点播页右侧操作栏:点赞/收藏/评论/分享 竖着排列
export interface OperationItem {
icon: Resource;
icon_check?: Resource;
// icon_selected: Resource;
text: string | Resource;
num?: number; // 个数
}
const TAG = 'PlayerRightView';
//视频点播页右侧操作栏:点赞/收藏/评论/分享 竖着排列
@Component
export struct PlayerRightView {
private playerController?: WDPlayerController;
... ... @@ -34,31 +25,10 @@ export struct PlayerRightView {
@Consume followStatus: string
@Consume isOpenDetail: boolean
@Consume isDragging: boolean
@State operationList: OperationItem[] = [
{
icon: $r('app.media.ic_like_uncheck'),
icon_check: $r('app.media.ic_like_check'),
text: "赞",
// num: 6622
},
{
icon: $r('app.media.ic_collect_uncheck'),
icon_check: $r('app.media.ic_collect_check'),
text: "收藏",
// num: 662,
},
{
icon: $r('app.media.ic_comment'),
text: "抢首评",
// num: 500,
},
{
icon: $r('app.media.ic_share'),
text: "分享"
}
]
@State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
aboutToAppear() {
}
/**
... ... @@ -82,11 +52,11 @@ export struct PlayerRightView {
if (this.newsStatusOfUser) {
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
if (this.newsStatusOfUser.likeStatus === '1') {
this.interactData.likeNum = Number(this.interactData.likeNum) + 1
this.interactData.likeNum = Number(this.interactData.likeNum || 0) + 1
} else {
this.interactData.likeNum = Number(this.interactData.likeNum) - 1
this.interactData.likeNum = Number(this.interactData.likeNum || 0) - 1
}
console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum)
console.log(TAG, '点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum)
// this.queryContentInteractCount()
}
... ... @@ -116,11 +86,11 @@ export struct PlayerRightView {
this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
// this.queryContentInteractCount()
if (this.newsStatusOfUser.collectStatus === 1) {
this.interactData.collectNum = Number(this.interactData.collectNum) + 1
this.interactData.collectNum = Number(this.interactData.collectNum || 0) + 1
} else {
this.interactData.collectNum = Number(this.interactData.collectNum) - 1
this.interactData.collectNum = Number(this.interactData.collectNum || 0) - 1
}
console.log('收藏、取消收藏==', this.newsStatusOfUser?.collectStatus, this.interactData?.collectNum)
console.log(TAG, '收藏、取消收藏==', this.newsStatusOfUser?.collectStatus, this.interactData?.collectNum)
}
})
... ... @@ -138,15 +108,15 @@ export struct PlayerRightView {
}
ContentDetailRequest.getContentInteract(params).then(res => {
if (res.data && this.interactData) {
this.interactData.likeNum = res.data[0]?.likeNum
this.interactData.collectNum = res.data[0]?.collectNum
this.interactData.commentNum = res.data[0]?.commentNum
this.interactData.likeNum = res.data[0]?.likeNum || 0
this.interactData.collectNum = res.data[0]?.collectNum || 0
this.interactData.commentNum = res.data[0]?.commentNum || 0
}
console.log('获取互动点赞等数据===', JSON.stringify(res))
})
}
getImgUrl() {
getHeadUrl() {
return this.contentDetailData?.rmhInfo?.rmhHeadUrl || this.contentDetailData?.userInfo?.userHeadUrl
}
... ... @@ -170,7 +140,7 @@ export struct PlayerRightView {
status: 1,
}
ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
console.log('关注号主==', JSON.stringify(res.data))
console.log(TAG, '关注号主==', JSON.stringify(res.data))
if (this.followStatus == '1') {
this.followStatus = '0'
} else {
... ... @@ -179,110 +149,177 @@ export struct PlayerRightView {
})
}
@Builder
buildUserComp() {
build() {
Column() {
if (this.getImgUrl()) {
RelativeContainer() {
Image(this.getImgUrl())
this.userBuilderView()
this.likeBuilderView()
this.collectBuilderView()
this.commentBuilderView()
this.shareBuilderView()
}
// .backgroundColor(Color.Blue)
// .height('100%')
.width(58)
.position({ x: '100%', y: '100%' })
.markAnchor({ x: '100%', y: '100%' })
.padding({ bottom: 72, right: 10 })
.visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible)
}
/**
* 用户关注、号主页
*/
@Builder
userBuilderView() {
Stack() {
Image(this.getHeadUrl())
.width('100%')
.borderRadius(24)
.aspectRatio(1)
.border({ width: 1, color: Color.White, style: BorderStyle.Solid })
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
.id("row1")
.onClick(() => {
// 跳转到号主页
if (this.contentDetailData.rmhInfo?.cnMainControl === 1) {
// 号主页
const params: Params = {
creatorId: this.contentDetailData.rmhInfo.rmhId,
pageID: ''
}
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
})
if (this.followStatus == '0') {
Image($r('app.media.ic_add'))
.width(24)
.borderRadius(12)
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Center },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
})
.margin({ left: -12 })
.id("row2")
.position({ x: '50%', y: '100%' })
.markAnchor({ x: '50%', y: '50%' })
.onClick(() => {
// 关注
// TODO:关注动画
this.handleAccention()
})
}
.height(48)
.width('100%')
.margin({ bottom: 30 })
.visibility(this.getHeadUrl() ? Visibility.Visible : Visibility.None)
}
/**
* 将点赞样式转换为icon
*/
transLikeStyle2Icon(): Resource {
if (this.likesStyle === 1) {
return this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_like_check`) : $r(`app.media.ic_like_uncheck`)
} else if (this.likesStyle === 2) {
return this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_thub_check`) : $r(`app.media.ic_thub_uncheck`)
} else if (this.likesStyle === 3) {
return this.newsStatusOfUser.likeStatus === '1' ? $r(`app.media.ic_candle_check`) : $r(`app.media.ic_candle_uncheck`)
}
return $r(`app.media.icon_like_ckeck`)
}
}.height(60)
transNum2String(name: 'likeNum' | 'collectNum' | 'commentNum') {
console.log(TAG, 'transNum2String', this.interactData.likeNum, this.interactData.collectNum, this.interactData.commentNum)
if (name === 'likeNum') {
return this.interactData.likeNum != 0 ? NumberFormatterUtils.formatNumberWithWan(this.interactData.likeNum || '') : ''
} else if (name === 'collectNum') {
return this.interactData.collectNum != 0 ? NumberFormatterUtils.formatNumberWithWan(this.interactData.collectNum || '') : ''
} else {
return this.interactData.commentNum != 0 ? NumberFormatterUtils.formatNumberWithWan(this.interactData.commentNum || '') : ''
}
}.margin({ bottom: 18 })
}
/**
* 点赞、默哀、祈福
*/
@Builder
buildOperationItem(item: OperationItem, index: number) {
likeBuilderView() {
Column() {
if (item.text === '赞') {
Image(this.newsStatusOfUser?.likeStatus == '1' ? item.icon_check : item.icon)
Image(this.transLikeStyle2Icon())
.width(32)
.aspectRatio(1)
.onClick(() => {
// TODO:点赞动画
this.toggleLikeStatus()
})
Text(this.interactData?.likeNum ? (this.interactData.likeNum + '') : item.text)
.width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown)
Text(this.transNum2String('likeNum') || '赞')
.width('100%')
.fontWeight(500)
.textAlign(TextAlign.Center)
.fontSize(13)
.fontColor('#FFFFFF')
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
} else if (item.text === '收藏') {
Image(this.newsStatusOfUser?.collectStatus == 1 ? item.icon_check : item.icon)
}
.margin({ bottom: 20 })
.visibility(this.likesStyle !== 4 ? Visibility.Visible : Visibility.None)
}
/**
* 收藏、取消收藏、收藏文件夹
*/
@Builder
collectBuilderView() {
Column() {
Image(this.newsStatusOfUser.collectStatus == 1 ? $r(`app.media.ic_collect_check`) : $r(`app.media.ic_collect_uncheck`))
.width(32)
.aspectRatio(1)
.onClick(() => {
this.toggleCollectStatus()
})
Text(this.interactData?.collectNum ? (this.interactData.collectNum + '') : item.text)
.width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown)
Text(this.transNum2String('collectNum') || '收藏')
.width('100%')
.fontWeight(500)
.textAlign(TextAlign.Center)
.fontSize(13)
.fontColor('#FFFFFF')
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
} else if (item.text === '抢首评') {
Image(item.icon)
}
.margin({ bottom: 20 })
}
/**
* 评论
*/
@Builder
commentBuilderView() {
Column() {
Image($r(`app.media.ic_comment`))
.width(32)
.aspectRatio(1)
.onClick((event: ClickEvent) => {
ToastUtils.showToast('评论为公共方法,待开发', 1000);
})
Text(this.interactData?.commentNum ? (this.interactData.commentNum + '') : item.text)
.width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown)
Text(this.transNum2String('commentNum') || '抢首评')
.width('100%')
.fontWeight(500)
.textAlign(TextAlign.Center)
.fontSize(13)
.fontColor('#FFFFFF')
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
} else {
Image(item.icon)
}
.margin({ bottom: 20 })
}
/**
* 分享
*/
@Builder
shareBuilderView() {
Column() {
Image($r(`app.media.ic_share`))
.width(32)
.aspectRatio(1)
.onClick((event: ClickEvent) => {
ToastUtils.showToast('分享为公共方法,待开发', 1000);
})
Text(item.text)
.width('100%')// .margin({ top: 4, left: 6, right: 6 })// .backgroundColor(Color.Brown)
Text('分享')
.width('100%')
.fontWeight(500)
.textAlign(TextAlign.Center)
.fontSize(13)
... ... @@ -290,26 +327,6 @@ export struct PlayerRightView {
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
}
// .width(48)
.margin({ bottom: 20 })
.alignItems(HorizontalAlign.Center)
.hoverEffect(HoverEffect.Scale)
}
build() {
Column() {
this.buildUserComp()
ForEach(this.operationList, (item: OperationItem, index: number) => {
this.buildOperationItem(item, index)
}, (item: OperationItem, index: number) => JSON.stringify(item))
}
.width(48)
.position({ x: '100%', y: '100%' })
.markAnchor({ x: '100%', y: '100%' })
.padding({ bottom: 72 })
.visibility(this.isOpenDetail || this.isDragging ? Visibility.None : Visibility.Visible)
}
}
\ No newline at end of file
... ...
... ... @@ -2,7 +2,7 @@ import { abilityAccessCtrl, bundleManager, Permissions } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
import { geoLocationManager } from '@kit.LocationKit';
import { SpConstants } from 'wdConstant/Index';
import { Logger, PermissionUtils, ResourcesUtils, SPHelper } from 'wdKit/Index';
import { EmitterEventId, EmitterUtils, Logger, PermissionUtils, ResourcesUtils, SPHelper } from 'wdKit/Index';
import { ResponseDTO } from 'wdNetwork/Index';
/**
... ... @@ -54,6 +54,11 @@ export class HWLocationUtils {
return
}
let context = getContext();
let per=SPHelper.default.getSync(SpConstants.LOCATION_PERMISSION_REFUSE,false)
if(!per){
EmitterUtils.sendEmptyEvent(EmitterEventId.LOCATION)
SPHelper.default.save(SpConstants.LOCATION_PERMISSION_REFUSE,true)
}
let requestGrant = await PermissionUtils.reqPermissionsFromUser([HWLocationUtils.APPROXIMATELY_LOCATION], context);
Logger.debug('location2 :' + requestGrant)
if (requestGrant) {
... ...
import { BottomNavigationComponent, LogoutViewModel } from 'wdComponent';
import { BottomNavigationComponent, LogoutViewModel, PermissionDesComponent } from 'wdComponent';
import { BreakpointConstants } from 'wdConstant';
import { BreakpointSystem, EmitterEventId, EmitterUtils, Logger } from 'wdKit';
... ... @@ -16,7 +16,7 @@ struct MainPage {
@Provide pageHide: number = -1
private breakpointSystem: BreakpointSystem = new BreakpointSystem()
@StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS;
@State isPermission: boolean = false
watchCurrentBreakpoint() {
Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`);
}
... ... @@ -28,6 +28,9 @@ struct MainPage {
EmitterUtils.receiveEvent(EmitterEventId.FORCE_USER_LOGIN_OUT, () => {
LogoutViewModel.clearLoginInfo()
})
EmitterUtils.receiveEvent(EmitterEventId.LOCATION, () => {
this.isPermission=true
})
}
aboutToDisappear() {
... ... @@ -50,8 +53,11 @@ struct MainPage {
}
build() {
Column() {
Stack({alignContent:Alignment.Top}) {
BottomNavigationComponent()
if(this.isPermission){
PermissionDesComponent()
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -60,7 +60,7 @@ struct LaunchAdvertisingPage {
Stack({alignContent:Alignment.Bottom}){
Column(){
if(!(this.model.launchAdInfo[0].matInfo.matType == '1')){
if(this.model.launchAdInfo.length && !(this.model.launchAdInfo[0].matInfo.matType == '1')){
//显示图片
Image(this.model.launchAdInfo[0].matInfo.matImageUrl[0])
.width('100%')
... ... @@ -100,7 +100,7 @@ struct LaunchAdvertisingPage {
}
.width('100%')
.height('100%')
if(!(this.model.launchAdInfo[0].matInfo.startStyle == 1)){
if(this.model.launchAdInfo.length && !(this.model.launchAdInfo[0].matInfo.startStyle == 1)){
//底部logo样式 按钮加载在背景展示图上
Button(){
Row(){
... ... @@ -133,7 +133,7 @@ struct LaunchAdvertisingPage {
.height('84%')
.margin({top:'0'})
if(this.model.launchAdInfo[0].matInfo.startStyle == 1){
if(this.model.launchAdInfo.length && this.model.launchAdInfo[0].matInfo.startStyle == 1){
//全屏样式,底部无logo 按钮放在原底部logo位置
Button(){
Row(){
... ... @@ -176,6 +176,7 @@ struct LaunchAdvertisingPage {
action(){
//跳转 url linkUrl https://news.bjd.com.cn/2024/03/19/10724331.shtml
// openType 端外 端内 打开
if(this.model.launchAdInfo.length){
if (this.model.launchAdInfo[0].matInfo.openType == '2') {
//端外打开
... ... @@ -189,6 +190,7 @@ struct LaunchAdvertisingPage {
}
}
}
... ...
... ... @@ -118,6 +118,7 @@ struct LaunchInterestsHobbiesPage {
// .rowsTemplate('1fr 1fr 1fr 1fr')
.columnsGap('23lpx')
.rowsGap('23lpx')
.scrollBar(BarState.Off)
Stack({alignContent:Alignment.Center}){
Button(this.selectCount == 0?'选好了':'选好了(' + this.selectCount + ')')
... ...
{
"code": "0",
"data": {
"list": [{
"appStyle": "15",
"imageUrl": ["https://sitcontentjdcdn.aikan.pdnews.cn/sjbj-20231204/image/live/563cc8ce1ecc43b288f6cf60da66579c.jpeg?x-oss-process=image/resize,l_550,m_fill,h_450,w_800/quality,q_90/format,jpg"],
"liveId": 20000007348,
"planStartTime": "2023-12-05 15:26:10",
"relId": "500000017021",
"relType": 1,
"startTime": "",
"status": "wait",
"title": "视界运营位加权-加权中删除"
}, {
"appStyle": "null",
"imageUrl": ["https://sitcontentjdcdn.aikan.pdnews.cn/sjbj-20230914/image/display/9af825a00abf490d8a8698f4fc079447.jpg?x-oss-process=image/resize,l_550,m_fill,h_450,w_800/quality,q_90/format,jpg"],
"liveId": 20000007492,
"planStartTime": "2024-01-12 20:00:00",
"relId": "500000020284",
"relType": 1,
"startTime": "",
"status": "wait",
"title": "QA|汉阴县凤堰古梯田"
}, {
"appStyle": "null",
"imageUrl": ["https://sitcontentjdcdn.aikan.pdnews.cn/sjbj-20230915/image/display/e908748c62a44109bbb7214f3fed458c.jpg?x-oss-process=image/resize,l_550,m_fill,h_450,w_800/quality,q_90/format,jpg"],
"liveId": 20000007493,
"planStartTime": "2024-01-12 20:00:00",
"relId": "500000020286",
"relType": 1,
"startTime": "",
"status": "wait",
"title": "二十四节气-夏至"
}, {
"appStyle": "null",
"imageUrl": ["https://sitcontentjdcdn.aikan.pdnews.cn/sjbj-20240118/image/display/732d6166103d4d2f9fbf512b128a3486.jpeg?x-oss-process=image/resize,l_550,m_fill,h_450,w_800/quality,q_90/format,jpg"],
"liveId": 20000007495,
"planStartTime": "2024-01-18 10:51:33",
"relId": "500000030122",
"relType": 1,
"startTime": "",
"status": "wait",
"title": "01181050文字直播没有预告片"
}, {
"appStyle": "null",
"imageUrl": ["https://sitcontentjdcdn.aikan.pdnews.cn/sjbj-20240127/image/live/6359d000bba24812b7ca1765bb106a49.png?x-oss-process=image/resize,l_550,m_fill,h_450,w_800/quality,q_90/format,jpg"],
"liveId": 20000007519,
"planStartTime": "2024-02-27 18:18:16",
"relId": "500000034054",
"relType": 1,
"startTime": "",
"status": "wait",
"title": "错搞民宿33"
}, {
"appStyle": "15",
"imageUrl": ["https://sitcontentjdcdn.aikan.pdnews.cn/sjbj-20240228/image/live/e6998ab547af472dbc19ba2fd68959b9.jpeg?x-oss-process=image/resize,l_550,m_fill,h_450,w_800/quality,q_90/format,jpg"],
"liveId": 20000007521,
"planStartTime": "2024-02-28 19:01:50",
"relId": "500000034162",
"relType": 1,
"startTime": "",
"status": "wait",
"title": "保存编辑弹幕开关"
}],
"pageNum": 1,
"pageSize": 20,
"totalCount": 6
},
"message": "Success",
"requestId": "65289f1217934cffb7587ff4d6ce4689",
"success": true,
"timestamp": 1710555152344
}
\ No newline at end of file
{
"code": "0",
"message": "Success",
"requestId": "9a63f8f9e61d442880a7537763fd1769",
"success": true,
"timestamp": 1711589284588
}
\ No newline at end of file
{
"code": "0",
"data": null,
"message": "Success",
"meta": null,
"requestId": "",
"success": true,
"timestamp": 1711609914928
}
\ No newline at end of file