王士厅
Showing 23 changed files with 516 additions and 196 deletions
... ... @@ -175,3 +175,6 @@ export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean';
export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean';
export { FeedBackParams } from './src/main/ets/bean/content/FeedBackParams';
... ...
... ... @@ -85,6 +85,8 @@ export class ContentDTO implements BaseDTO {
// 链接类型: 0:无链接;1:内链(文章);2:外链
openType: string = '';
extra: string = ''
sameContentList:ContentDTO[] = []
sameContentListJson:string = ""
/*
本地辅助字段
*/
... ...
export interface FeedBackParams {
content:string
classifyFlagIds:string
userContact:string
userName:string
appVersion:string
appDevice:string
}
\ No newline at end of file
... ...
export interface FeedbackTypeBean {
classifyName: string;
id: number;
isselect: boolean;
isSelect: boolean;
}
\ No newline at end of file
... ...
... ... @@ -16,6 +16,8 @@ export { LikeComponent } from "./src/main/ets/components/view/LikeComponent"
export { TopNavigationComponent } from "./src/main/ets/components/page/TopNavigationComponent"
export { TopNavigationComponentNew } from "./src/main/ets/components/page/TopNavigationComponentNew"
export { LabelComponent } from "./src/main/ets/components/view/LabelComponent"
export { BannerComponent } from "./src/main/ets/components/view/BannerComponent"
... ...
import { FeedbackTypeBean, PhotoListBean } from 'wdBean/Index';
import { FeedBackParams, FeedbackTypeBean, PhotoListBean } from 'wdBean/Index';
import { AppUtils,
DeviceUtil,
FastClickUtil, Logger, NetworkUtil, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index';
... ... @@ -60,9 +60,9 @@ export struct FeedBackActivity {
GridCol({
}) {
Row(){
Toggle({ type: ToggleType.Checkbox, isOn: false })
Toggle({ type: ToggleType.Checkbox, isOn: feedbackTypeBean.isSelect })
.onChange((select) => {
feedbackTypeBean.isselect = select
feedbackTypeBean.isSelect = select
this.canSubmit = this.checkSubmit()
})
Text(feedbackTypeBean.classifyName)
... ... @@ -325,8 +325,8 @@ export struct FeedBackActivity {
//问题类型必选
let selectType = ""
this.feedbackTypeBeans.forEach((value) => {
if(value.isselect){
selectType = selectType+","
if(value.isSelect){
selectType = selectType+value.id+","
}
})
if(!StringUtils.isEmpty(selectType)){
... ... @@ -343,29 +343,31 @@ export struct FeedBackActivity {
}
try {
let map: HashMap<String,String> = {} as HashMap<String,String>
//反馈内容
map.set("content", this.contact);
//投诉类型 id
map.set("classifyFlagIds", selectType);
if(!StringUtils.isEmpty(this.email)){
let feedBackParams: FeedBackParams = {
//反馈内容
"content": this.contact,
//投诉类型 id
"classifyFlagIds": selectType,
//设备
"appVersion": "V" + AppUtils.getAppVersionName(),
"appDevice": "harmony" + DeviceUtil.getDisplayVersion() + " " + DeviceUtil.getProductModel()
} as FeedBackParams
//邮箱
map.set("userContact", this.email);
if(!StringUtils.isEmpty(this.email)){
feedBackParams.userContact = this.email
}
//用户名称
if (!StringUtils.isEmpty(UserDataLocal.getUserName())) {
map.set("userName", UserDataLocal.getUserName());
if(!StringUtils.isEmpty(UserDataLocal.getUserName())){
feedBackParams.userName = UserDataLocal.getUserName()
}
//设备
map.set("appVersion", "V" + AppUtils.getAppVersionName());
map.set("appDevice", "harmony" + DeviceUtil.getDisplayVersion() + " " + DeviceUtil.getProductModel());
// //投诉图片
// if (imageUrl.size() > 0) {
// String[] str = imageUrl.toArray(new String[imageUrl.size()]);
// map.set("imageUrls", str);
// }
await MultiPictureDetailViewModel.feedBackCommit(map)
await MultiPictureDetailViewModel.feedBackCommit(feedBackParams)
router.back();
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
}
... ...
... ... @@ -40,9 +40,9 @@ export struct Card11Component {
Column() {
Stack() {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(27).align(Alignment.Center)
Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType }).height(27).align(Alignment.Center)
Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center)
}
Text() {
if (this.titleMarked) {
... ...
... ... @@ -49,9 +49,11 @@ export struct Card2Component {
Stack() {
//新闻标题
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags })
Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center)
//Notes({ newTags: this.contentDTO.newTags })
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center)
//Notes({ objectType: this.contentDTO.objectType })
}
Text() {
... ...
... ... @@ -45,29 +45,32 @@ export struct Card4Component {
Column() {
//body
Column() {
//新闻标题
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags })
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
Stack() {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags }).height(19).align(Alignment.Center)
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType }).height(19).align(Alignment.Center)
}
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
}
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
(this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||
this.contentDTO.objectType == '5' ? 30 : 0)
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
(this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||
this.contentDTO.objectType == '5' ? 30 : 0)
}.alignContent(Alignment.TopStart)
//新闻标题
//三图
Stack(){
Row() {
... ...
/**
* More_Comp
*/
import { ContentDTO } from 'wdBean/Index';
const TAG: string = 'Card9Component';
@Entry
@Component
export struct MoreComponent {
@State contentDTO: ContentDTO = new ContentDTO();
build() {
Row() {
... ...
... ... @@ -38,25 +38,32 @@ export struct AppointmentListChildComponent {
.interpolation(ImageInterpolation.High)
if (this.item.relType === 1) {
if (this.item.status == "wait") {
Row() {
Row() {
Image($r('app.media.reserve_icon'))
.width('42lpx')
.height('35lpx')
.width('27lpx')
.height('27lpx')
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.margin({right:"6lpx"})
Text("预约")
.fontWeight(400)
.fontSize('21lpx')
.backgroundColor($r('app.color.color_4D000000'))
.fontSize('23lpx')
.textShadow({
radius: 2,
color: `rgba(0,0,0,0.3)`,
offsetY:2,
offsetX:0
})
.fontColor($r('app.color.white'))
.lineHeight('31lpx')
.layoutWeight(1)
.textAlign(TextAlign.Center)
.textAlign(TextAlign.Start)
}.width('94lpx')
.margin({ bottom: '15lpx', right: '15lpx' })
.alignItems(VerticalAlign.Center)
}.width('100%')
.height('100%')
.alignItems(VerticalAlign.Bottom)
... ... @@ -78,7 +85,7 @@ export struct AppointmentListChildComponent {
.width('100%')
Row() {
Row() {
if (this.item.relType === 2) {
if (this.item.status == "end") {
Image($r('app.media.play_status_history_icon'))
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
... ... @@ -88,6 +95,16 @@ export struct AppointmentListChildComponent {
Text('已结束').fontColor($r('app.color.color_999999'))
.fontWeight('500lpx')
.fontSize('23lpx')
}else if(this.item.status == "running"){
Image($r('app.media.play_status_icon'))
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.width('38lpx')
.height('38lpx')
.margin({ right: '12lpx' })
Text('已开始').fontColor($r('app.color.color_999999'))
.fontWeight('500lpx')
.fontSize('23lpx')
} else {
Image($r('app.media.play_status_icon'))
.objectFit(ImageFit.Auto)
... ... @@ -118,7 +135,7 @@ export struct AppointmentListChildComponent {
Blank()
.layoutWeight(1)
if (this.item.relType === 1) {
if (this.item.status === "wait") {
Text(this.item.isAppointment ? "已预约" : "预约")
.fontWeight(400)
.fontSize('23lpx')
... ... @@ -132,8 +149,19 @@ export struct AppointmentListChildComponent {
.onClick(() => {
this.dialogController.open()
})
}else if(this.item.status == "running"){
Text("去观看" )
.fontWeight(400)
.fontSize('23lpx')
.backgroundColor($r('app.color.color_ED2800'))
.fontColor($r('app.color.white'))
.lineHeight('31lpx')
.textAlign(TextAlign.Center)
.width('100lpx')
.height('46lpx')
.borderRadius('6lpx')
} else {
Text(this.item.relType === 2 ? "去观看" : "看回放")
Text("看回放")
.fontWeight(400)
.fontSize('23lpx')
.backgroundColor($r('app.color.color_ED2800'))
... ...
... ... @@ -7,17 +7,20 @@ import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { EmptyComponent } from '../../view/EmptyComponent';
import { Action } from 'wdBean/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
const TAG = "AppointmentListUI"
@Component
export struct AppointmentListUI {
@State data: LazyDataSource<MineAppointmentItem> = new LazyDataSource();
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State count: number = 0;
@State isLoading: boolean = false
@State hasMore: boolean = true
curPageNum: number = 1;
@State isGetRequest: boolean = false
private scroller: Scroller = new Scroller();
aboutToAppear() {
this.getNewPageData()
... ... @@ -26,7 +29,7 @@ export struct AppointmentListUI {
build() {
Column() {
//标题栏目
CustomTitleUI({ titleName: "预约列表" })
CustomTitleUI({ titleName: "我的预约" })
if (this.count == 0) {
if (this.isGetRequest == true) {
EmptyComponent({ emptyType: 10 })
... ... @@ -35,45 +38,29 @@ export struct AppointmentListUI {
}
} else {
//刷新控件 TODO
//List
List({ space: '6lpx' }) {
LazyForEach(this.data, (item: MineAppointmentItem, index: number) => {
ListItem() {
AppointmentListChildComponent({ item: item })
}
.onClick(() => {
//TODO 跳转
let action = {
type:"2",
params:{
extra:{
relId:item.relId,
relType:item.relType.toString()
},
contentID:item.liveId.toString()
}
} as Action
WDRouterRule.jumpWithPage(WDRouterPage.detailPlayLiveCommon, action)
})
}, (item: MineAppointmentItem, index: number) => index.toString())
//没有更多数据 显示提示
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI()
CustomPullToRefresh({
alldata:this.data,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.curPageNum = 1;
this.hasMore = true
this.isGetRequest = false
this.data.clear()
if (!this.isLoading){
this.getNewPageData()
if(resolve) resolve('刷新成功')
}
},
onLoadMore:(resolve)=> {
if (!this.isLoading) {
this.isLoading = true
this.getNewPageData()
}
}
}
.cachedCount(4)
.scrollBar(BarState.Off)
.margin({ top: '23lpx', left: '23lpx', right: '23lpx' })
.layoutWeight(1)
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
//加载分页数据
this.getNewPageData()
}
})
}
... ... @@ -83,6 +70,42 @@ export struct AppointmentListUI {
.width('100%')
}
@Builder ListLayout(){
List({ space:6,scroller: this.scroller }) {
LazyForEach(this.data, (item: MineAppointmentItem, index: number) => {
ListItem() {
AppointmentListChildComponent({ item: item })
}
.onClick(() => {
//TODO 跳转
let action = {
type:"2",
params:{
extra:{
relId:item.relId,
relType:item.relType.toString()
},
contentID:item.liveId.toString()
}
} as Action
WDRouterRule.jumpWithPage(WDRouterPage.detailPlayLiveCommon, action)
})
}, (item: MineAppointmentItem, index: number) => index.toString())
//没有更多数据 显示提示
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI()
}.padding({bottom:px2vp(this.bottomSafeHeight) + 20})
}
}
.cachedCount(4)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.margin({ top: '23lpx', left: '23lpx', right: '23lpx'})
.layoutWeight(1)
}
getNewPageData() {
this.isLoading = true
if (this.hasMore) {
... ...
... ... @@ -460,9 +460,19 @@ export struct TopNavigationComponent {
}
/**
* 判断是否当前页面处理逻辑,如消息通知,只需要切换到当前底导的处理,过滤掉非当前。
*/
private isCurrentPage(): boolean {
return this._currentNavIndex === this.navIndex
}
/**
* 频道id变化,即指定频道跳转场景
*/
onAssignChannelChange() {
if (!this.isCurrentPage()) {
return
}
let channelId = this.assignChannel.channelId
let index = -1
if (this._currentNavIndex === 0) {
... ...
... ... @@ -72,68 +72,70 @@ export struct TopNavigationComponentNew {
private tabsWidth: number = 0
build() {
// 频道分类list
RelativeContainer() {
this.tabBar()
Swiper(this.swiperController) {
ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList,
(navItem: TopNavDTO, index: number) => {
if (this.currentBottomNavName === '人民号' && navItem.name === '关注') {
PeopleShipMainComponent({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
navIndex: index,
pageId: navItem.pageId + '',
channelId: navItem.channelId + '',
})
} else
if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
PageComponent({
Column() {
// 频道分类list
RelativeContainer() {
this.tabBar()
Swiper(this.swiperController) {
ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList,
(navItem: TopNavDTO, index: number) => {
if (this.currentBottomNavName === '人民号' && navItem.name === '关注') {
PeopleShipMainComponent({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
navIndex: index,
pageId: navItem.pageId + '',
channelId: navItem.channelId + '',
autoRefresh: this.autoRefresh2Page
})
} else {
channelSkeleton()
} else
if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
PageComponent({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
navIndex: index,
pageId: navItem.pageId + '',
channelId: navItem.channelId + '',
autoRefresh: this.autoRefresh2Page
})
} else {
channelSkeleton()
}
})
}
.loop(false)
.indicator(false)
.effectMode(EdgeEffect.None)
.index(this.currentTopNavSelectedIndex)
.cachedCount(0)
.id('pageContent')
.alignRules({
'top': { 'anchor': 'tabList', 'align': VerticalAlign.Bottom },
'middle': { 'anchor': '__container__', 'align': HorizontalAlign.Center },
'bottom': { 'anchor': '__container__', 'align': VerticalAlign.Bottom }
})
.onChange((index) => {
Logger.info(TAG, `onChange index : ${index}`);
if (this.isBroadcastByIndex(index)) {
// 跳转到播报页面
ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId)
let nextIndex = this.currentTopNavSelectedIndex > index ? index - 1 : index + 1
if (nextIndex < this.myChannelList.length) {
this.changePage(nextIndex)
}
})
}
.loop(false)
.indicator(false)
.effectMode(EdgeEffect.None)
.index(this.currentTopNavSelectedIndex)
.cachedCount(0)
.id('pageContent')
.alignRules({
'top': { 'anchor': 'tabList', 'align': VerticalAlign.Bottom },
'middle': { 'anchor': '__container__', 'align': HorizontalAlign.Center },
'bottom': { 'anchor': '__container__', 'align': VerticalAlign.Bottom }
})
.onChange((index) => {
Logger.info(TAG, `onChange index : ${index}`);
if (this.isBroadcastByIndex(index)) {
// 跳转到播报页面
ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId)
let nextIndex = this.currentTopNavSelectedIndex > index ? index - 1 : index + 1
if (nextIndex < this.myChannelList.length) {
this.changePage(nextIndex)
}
} else if (this.isLayoutByIndex(index)) {
ProcessUtils.gotoENewsPaper()
let nextIndex = this.currentTopNavSelectedIndex > index ? index - 1 : index + 1
if (nextIndex < this.myChannelList.length) {
this.changePage(nextIndex)
} else if (this.isLayoutByIndex(index)) {
ProcessUtils.gotoENewsPaper()
let nextIndex = this.currentTopNavSelectedIndex > index ? index - 1 : index + 1
if (nextIndex < this.myChannelList.length) {
this.changePage(nextIndex)
}
} else {
this.currentTopNavSelectedIndex = index;
this.changePage(this.currentTopNavSelectedIndex)
}
} else {
this.currentTopNavSelectedIndex = index;
this.changePage(this.currentTopNavSelectedIndex)
}
})
})
}
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
@Builder
... ... @@ -316,7 +318,7 @@ export struct TopNavigationComponentNew {
bottom: 2,
})
.id(`col_tabBar${index}`)
.margin({ right: this.myChannelList.length === index + 1 ? 36 : 0 })
// .margin({ right: this.myChannelList.length === index + 1 ? 36 : 0 })
.onClick(() => {
Logger.debug(TAG, `onClick, index: ${index}`);
if (this.currentTopNavSelectedIndex === index) {
... ... @@ -487,9 +489,19 @@ export struct TopNavigationComponentNew {
}
/**
* 判断是否当前页面处理逻辑,如消息通知,只需要切换到当前底导的处理,过滤掉非当前。
*/
private isCurrentPage(): boolean {
return this._currentNavIndex === this.bottomNavIndex
}
/**
* 频道id变化,即指定频道跳转场景
*/
onAssignChannelChange() {
if (!this.isCurrentPage()) {
return
}
let channelId = this.assignChannel.channelId
let index = -1
if (this._currentNavIndex === 0) {
... ... @@ -537,7 +549,7 @@ export struct TopNavigationComponentNew {
private getChannelByMine(channelId: string) {
for (let i = 0; i < this.myChannelList.length; i++) {
let topNavDTO: TopNavDTO = this.myChannelList[i]
if (topNavDTO.channelId?.toString() === channelId) {
if (topNavDTO?.channelId?.toString() === channelId) {
return i
}
}
... ...
... ... @@ -26,7 +26,6 @@ export struct CustomTitleUI {
}
Text(this.titleName)
.height('42lpx')
.maxLines(1)
.id("title")
.fontSize('35lpx')
... ...
... ... @@ -49,7 +49,7 @@ export struct SearchComponent {
getRelatedSearchContent() {
if(StringUtils.isNotEmpty(this.searchText)){
SearcherAboutDataModel.getRelatedSearchContentData(encodeURI(this.searchText),getContext(this)).then((value) => {
if (value != null) {
if (value != null && value.length > 0) {
this.relatedSearchContentsData = []
value.forEach(item=>{
let tempValue:string = item
... ... @@ -81,6 +81,9 @@ export struct SearchComponent {
this.relatedSearchContentsData.push(new SearchRelatedItem(item,tempArr))
}
})
}else{
this.hasInputContent = false
this.relatedSearchContentsData = []
}
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
... ... @@ -228,7 +231,7 @@ export struct SearchComponent {
Row() {
//左
Stack({ alignContent: Alignment.Start }) {
if (this.searchTextData != null && this.searchTextData.length > 0 && !this.hasInputContent) {
if (this.searchTextData != null && this.searchTextData.length > 0 && !this.hasInputContent && StringUtils.isEmpty(this.searchText)) {
Swiper(this.swiperController) {
ForEach(this.searchTextData, (item: string, index: number) => {
Text(item)
... ...
... ... @@ -20,12 +20,16 @@ import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'
import { FollowListStatusRequestItem } from '../../viewmodel/FollowListStatusRequestItem'
import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem'
import { SearchResultContentData } from '../../viewmodel/SearchResultContentData'
import { SearchResultContentItem, SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
import {
SearchDescription,
SearchResultContentItem, SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
import { CardParser } from '../CardParser'
import { FollowChildComponent } from '../mine/follow/FollowChildComponent'
import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'
import { ActivityItemComponent } from './ActivityItemComponent'
import { SearchCreatorComponent } from './SearchCreatorComponent'
import { JSON } from '@kit.ArkTS'
import { MoreComponent } from '../cardview/MoreComponent'
const TAG = "SearchResultContentComponent"
... ... @@ -34,6 +38,7 @@ export struct SearchResultContentComponent {
@State keywords: string = ""
@State searchType: string = ""
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
tempList : ContentDTO[] = []
@State data_rmh: SearchRmhDescription[] = []
@State count: number = -1;
@State isLoading: boolean = false
... ... @@ -62,7 +67,7 @@ export struct SearchResultContentComponent {
getNewSearchResultData() {
this.isLoading = true
if (this.hasMore) {
SearcherAboutDataModel.getSearchResultListData("15", `${this.curPageNum}`, this.searchType, this.keywords,
SearcherAboutDataModel.getSearchResultListData("20", `${this.curPageNum}`, this.searchType, this.keywords,
getContext(this)).then((value) => {
console.log('SearcherAboutDataModel', JSON.stringify(value))
if (!this.data || value.list.length == 0) {
... ... @@ -183,9 +188,8 @@ export struct SearchResultContentComponent {
resultData.list.forEach((value:SearchResultContentItem) => {
creatorIdList.push(value.data.creatorId)
})
let isRemain : boolean = false
SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList}).then((rem) => {
resultData.list.forEach((value) => {
let photos: FullColumnImgUrlDTO[] = []
// if (value.data.appStyle === 4) {
... ... @@ -196,42 +200,98 @@ export struct SearchResultContentComponent {
// }
let contentDTO = this.dataTransform(rem,value, photos);
if(value.data.type != "13"){
this.data.push(contentDTO)
this.tempList.push(contentDTO)
if(value.data.sameContentList != null && value.data.sameContentList.length > 0) {
let contentDTO2 = new ContentDTO();
contentDTO2.sameContentListJson = JSON.stringify(value.data.sameContentList)
isRemain = true
this.tempList.push(contentDTO2)
}
}
})
if(!isRemain){
this.tempList.forEach((value) => {
this.data.push(value)
})
this.tempList = []
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.count < resultData.totalCount) {
this.curPageNum++
} else {
this.hasMore = false
}
this.isLoading = false
}else{
this.dealSameContent(resultData.totalCount)
}
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.data.totalCount() < resultData.totalCount) {
this.curPageNum++
} else {
this.hasMore = false
}
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
this.count = this.count === -1 ? 0 : this.count
})
}
if (this.count === 0 && resultData.list.length > 0) {
this.count = -1
if (!this.isLoading) {
//加载分页数据
this.getNewSearchResultData()
async dealSameContent(count:number){
this.tempList.forEach(async (tempValue) => {
if(StringUtils.isNotEmpty(tempValue.sameContentListJson)){
let data: contentListParams = {
contentList: []
}
} else if (this.count <= 10 && resultData.list.length > 0) {
if (!this.isLoading) {
//加载分页数据
this.getNewSearchResultData()
let resultData : SearchDescription[] = JSON.parse(tempValue.sameContentListJson) as SearchDescription[]
if(resultData!=null){
resultData.forEach((item) => {
data.contentList.push({
contentId: item.id + '',
contentType: Number.parseInt(item.type)
})
})
let newValue = await SearcherAboutDataModel.getInteractListData(data, getContext(this))
newValue.forEach((item) => {
resultData.forEach((data) => {
if (item.contentId == data.id) {
data.collectNum = item.collectNum + ""
data.commentNum = item.commentNum + ""
data.likeNum = item.likeNum + ""
data.readNum = item.readNum + ""
data.shareNum = item.shareNum + ""
}
})
})
let creatorIdList: string[] = []
resultData.forEach((value:SearchDescription) => {
creatorIdList.push(value.creatorId)
})
let rem = await SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList})
resultData.forEach((value) => {
let photos: FullColumnImgUrlDTO[] = []
value.appStyleImages.split("&&").forEach((value) => {
const resizeParams = this.extractResizeParams(value)
photos.push({ fullUrl: value,weight:resizeParams.width,height:resizeParams.height, } as FullColumnImgUrlDTO)
})
let contentDTO = this.dataTransform2(rem,value, photos);
tempValue.sameContentList.push(contentDTO)
})
}
}
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
this.count = this.count === -1 ? 0 : this.count
})
this.tempList.forEach((value) => {
this.data.push(value)
})
this.tempList = []
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.count < count) {
this.curPageNum++
} else {
this.hasMore = false
}
this.isLoading = false
}
build() {
... ... @@ -258,6 +318,8 @@ export struct SearchResultContentComponent {
Column() {
if (this.searchType == "activity") {
ActivityItemComponent({ contentDTO: item })
}else if(item.sameContentList != null && item.sameContentList.length > 0){
MoreComponent({ contentDTO: item })
} else {
CardParser({compDTO:new CompDTO, contentDTO: item })
}
... ... @@ -284,7 +346,6 @@ export struct SearchResultContentComponent {
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
//加载分页数据
this.getNewSearchResultData()
}
})
... ... @@ -476,10 +537,94 @@ export struct SearchResultContentComponent {
contentDTO.shareFlag = value.data.shareFlag
contentDTO.contentText = value.data.contentText
return contentDTO;
}
private dataTransform2(rem:CreatorDetailResponseItem[],value: SearchDescription, photos: FullColumnImgUrlDTO[]): ContentDTO {
let rmhInfo = this.getRmhInfo2(rem,value)
console.log('获取photos',JSON.stringify(photos))
console.log('获取value2',JSON.stringify(value))
let contentDTO = new ContentDTO();
contentDTO.appStyle = value.appStyle + ""
contentDTO.cityCode = value.cityCode
contentDTO.coverSize = ""
contentDTO.coverType = value.type == "5" ? 1 : -1
contentDTO.coverUrl =
this.searchType == "activity" ? value.zhChannelPageImg : value.appStyleImages.split("&&")[0];
contentDTO.description = value.description
contentDTO.districtCode = value.districtCode
contentDTO.endTime = value.endTime
contentDTO.hImageUrl = ""
contentDTO.heatValue = ""
contentDTO.innerUrl = ""
contentDTO.landscape = Number.parseInt(value.landscape)
contentDTO.linkUrl = value.linkUrl
contentDTO.openLikes = Number.parseInt(value.openLikes)
contentDTO.openUrl = ""
contentDTO.pageId = value.pageId
contentDTO.programAuth = ""
contentDTO.programId = ""
contentDTO.programName = ""
contentDTO.programSource = -1
contentDTO.programType = Number.parseInt(value.status)
contentDTO.provinceCode = value.provinceCode
contentDTO.showTitleEd = value.showTitleEd
contentDTO.showTitleIng = value.showTitleIng
contentDTO.showTitleNo = value.showTitleNo
contentDTO.startTime = value.startTime
contentDTO.subType = ""
contentDTO.subtitle = ""
contentDTO.title = value.title
contentDTO.vImageUrl = ""
contentDTO.screenType = ""
contentDTO.source = StringUtils.isEmpty(value.creatorName) ? value.sourceName : value.creatorName
contentDTO.objectId = value.id
contentDTO.objectType = value.type
contentDTO.channelId = value.channelId
contentDTO.relId = value.relId
contentDTO.relType = value.relType
contentDTO.newsTitle = value.titleLiteral;
contentDTO.publishTime =
StringUtils.isNotEmpty(value.firstPublishTime) ? value.firstPublishTime : value.publishTime
contentDTO.visitorComment = -1
contentDTO.fullColumnImgUrls = photos
contentDTO.newsSummary = ""
contentDTO.hasMore = -1
contentDTO.slideShows = []
contentDTO.voiceInfo = {} as VoiceInfoDTO
contentDTO.tagWord = -1
contentDTO.isSelect = true
contentDTO.rmhInfo = {} as RmhInfoDTO
contentDTO.photoNum = -1
contentDTO.liveInfo = {} as LiveInfoDTO;
contentDTO.videoInfo = {
videoDuration: Number.parseInt(value.duration)
} as VideoInfoDTO;
let interact = new InteractDataDTO()
interact.collectNum = value.collectNum
interact.commentNum = value.commentNum
interact.contentId = value.id
interact.contentType = Number.parseInt(value.type)
interact.likeNum = value.likeNum
interact.readNum = Number.parseInt(value.readNum)
interact.shareNum = Number.parseInt(value.shareNum)
contentDTO.interactData = interact
contentDTO.corner = ''
contentDTO.rmhPlatform = 0
contentDTO.newTags = ''
contentDTO.isSearch = true
contentDTO.publishTimestamp = ""
contentDTO.bottomNavId = '';
contentDTO.openType = '';
contentDTO.extra = '';
contentDTO.titleShow = value.type == "5" ? 1 : 0;
contentDTO.rmhInfo = rmhInfo
contentDTO.shareFlag = value.shareFlag
contentDTO.contentText = value.contentText
return contentDTO;
}
}
// 搜索数据转化rmhInfo
private getRmhInfo(rem:CreatorDetailResponseItem[],value:SearchResultContentItem){
let obj = value.data
... ... @@ -535,6 +680,65 @@ export struct SearchResultContentComponent {
}
return rmhInfo
}
// 搜索数据转化rmhInfo
private getRmhInfo2(rem:CreatorDetailResponseItem[],value:SearchDescription){
let obj = value
let rmhInfo:RmhInfoDTO = {
rmhHeadUrl:obj.headerPhotoUrl,
rmhName:obj.creatorName,
rmhId:obj.creatorId,
authIcon:obj.authIcon,
authTitle: obj.authTitle,
authTitle2: '',
banControl: 0,
cnIsAttention: 0,
cnAttention: 0,
cnlsComment: 0,
cnlsLike: 0,
cnMainControl: 0,
cnShareControl: 0,
cnIsComment: 0,
cnIsLike:0,
posterShareControl: 0,
rmhDesc: obj.introduction,
userId: obj.userId,
userType: obj.userType,
honoraryIcon:''
}
if(rem.length>0){
rem.forEach(item=>{
if(item.creatorId === obj.creatorId){
rmhInfo = {
rmhHeadUrl:item.headPhotoUrl,
rmhName:item.userName,
rmhId:item.creatorId,
authIcon:item.authIcon,
authTitle: item.authTitle,
authTitle2: '',
banControl: 0,
cnIsAttention:item.isAttention,
cnAttention: 0,
cnlsComment: 0,
cnlsLike: 0,
cnMainControl: 0,
cnShareControl: 0,
cnIsComment: 0,
cnIsLike:0,
posterShareControl: 0,
rmhDesc: item.introduction,
userId: item.userId,
userType: item.userType,
honoraryIcon:''
}
}
})
}
return rmhInfo
}
private extractResizeParams(url: string) {
const heightRegex = /h_(\d+)/; // 匹配高度参数,如h_450
const widthRegex = /w_(\d+)/; // 匹配宽度参数,如w_800
... ...
... ... @@ -8,11 +8,12 @@ import { ContentDetailDTO,
postBatchAttentionStatusResult,
postInteractBrowsOperateParams,
InteractDataDTO,
FeedbackTypeBean
FeedbackTypeBean,
FeedBackParams
} from 'wdBean';
import { PageRepository } from '../repository/PageRepository';
import { ArrayList } from '@kit.ArkTS';
import { ToastUtils} from 'wdKit/Index';
const TAG = 'MultiPictureDetailViewModel';
export class MultiPictureDetailViewModel {
... ... @@ -158,15 +159,16 @@ export class MultiPictureDetailViewModel {
})
}
static async feedBackCommit(params:HashMap<String,String>): Promise<ResponseDTO> {
return new Promise<ResponseDTO>((success, error) => {
static async feedBackCommit(params:FeedBackParams): Promise<object> {
return new Promise<object>((success, error) => {
Logger.info(TAG, `fetchDetailData start`);
WDHttp.post(HttpUrlUtils.getHost() + HttpUrlUtils.FEEDBACK_COMMIT_PATH,params).then((resDTO: ResponseDTO) => {
WDHttp.post(HttpUrlUtils.getHost() + HttpUrlUtils.FEEDBACK_COMMIT_PATH,params).then((resDTO: object) => {
success(resDTO);
ToastUtils.shortToast('反馈成功')
}).catch((err: Error) => {
Logger.error(TAG, `fetchDetailData catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
ToastUtils.shortToast('反馈失败')
})
})
}
... ...
... ... @@ -5,7 +5,7 @@ export class SearchResultContentItem{
resultType:string = ""
}
class SearchDescription{
export class SearchDescription{
likeEnable: string = ""
previewUri: string = ""
firstFrameImageBucket: string = ""
... ... @@ -178,7 +178,7 @@ class SearchDescription{
likeNum: string= ""
readNum: string= ""
shareNum: string= ""
sameContentList:SearchDescription[] = []
}
@Observed
... ...
... ... @@ -4,7 +4,7 @@ import { EmitterEventId, EmitterUtils, Logger, StringUtils } from 'wdKit';
import { HttpUtils } from 'wdNetwork/Index';
import HomeChannelUtils, { AssignChannelParam } from 'wdRouter/Index';
import { MinePageComponent } from 'wdComponent/src/main/ets/components/page/MinePageComponent';
import { CompUtils, TopNavigationComponent } from 'wdComponent/Index';
import { CompUtils, TopNavigationComponent, TopNavigationComponentNew } from 'wdComponent/Index';
import { VideoChannelPage } from './VideoChannelPage';
import ChannelViewModel from 'wdComponent/src/main/ets/viewmodel/ChannelViewModel';
... ... @@ -17,6 +17,7 @@ let storage = LocalStorage.getShared();
@Entry(storage)
@Component
export struct BottomNavigationComponent {
private isNewTopPage = true // TODO 顶导重构页面开关,false,则用原来的顶导
@Provide bottomRectHeight: number = 0
@Provide topRectHeight: number = 0
@Provide isLayoutFullScreen: boolean = false
... ... @@ -82,15 +83,28 @@ export struct BottomNavigationComponent {
autoRefresh: this.autoRefresh
})
} else {
TopNavigationComponent({
groupId: navItem.id,
topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
_currentNavIndex: $currentNavIndex,
navIndex: index,
currentBottomNavName: navItem.name,
assignChannel: this.assignChannel,
autoRefresh: this.autoRefresh
})
if (this.isNewTopPage) {
TopNavigationComponentNew({
groupId: navItem.id,
topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
_currentNavIndex: $currentNavIndex,
bottomNavIndex: index,
currentBottomNavName: navItem.name,
assignChannel: this.assignChannel,
autoRefresh: this.autoRefresh
})
} else {
TopNavigationComponent({
groupId: navItem.id,
topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
_currentNavIndex: $currentNavIndex,
navIndex: index,
currentBottomNavName: navItem.name,
assignChannel: this.assignChannel,
autoRefresh: this.autoRefresh
})
}
}
}
.tabBar(this.tabBarBuilder(navItem, index))
... ...