Showing
19 changed files
with
191 additions
and
172 deletions
| @@ -65,6 +65,13 @@ export class CollectionUtils { | @@ -65,6 +65,13 @@ export class CollectionUtils { | ||
| 65 | return collection.length > 0; | 65 | return collection.length > 0; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | + static getElement(collection?: any[], index?: number): any { | ||
| 69 | + if (CollectionUtils.isEmpty(collection) || index === undefined) { | ||
| 70 | + return null; | ||
| 71 | + } | ||
| 72 | + return index >= 0 && index < collection.length ? collection[index] : null; | ||
| 73 | + } | ||
| 74 | + | ||
| 68 | static getListSize(collection?: any[]): number { | 75 | static getListSize(collection?: any[]): number { |
| 69 | return CollectionUtils.isEmpty(collection) ? 0 : collection.length; | 76 | return CollectionUtils.isEmpty(collection) ? 0 : collection.length; |
| 70 | } | 77 | } |
| @@ -180,12 +187,5 @@ export class CollectionUtils { | @@ -180,12 +187,5 @@ export class CollectionUtils { | ||
| 180 | return collection.slice(start, end); | 187 | return collection.slice(start, end); |
| 181 | } | 188 | } |
| 182 | 189 | ||
| 183 | - | ||
| 184 | - static getElement(collection?: any[], index?: number): any { | ||
| 185 | - if (CollectionUtils.isEmpty(collection) || index === undefined) { | ||
| 186 | - return null; | ||
| 187 | - } | ||
| 188 | - return index >= 0 && index < collection.length ? collection[index] : null; | ||
| 189 | - } | ||
| 190 | } | 190 | } |
| 191 | 191 |
| @@ -37,7 +37,7 @@ export class HttpUrlUtils { | @@ -37,7 +37,7 @@ export class HttpUrlUtils { | ||
| 37 | /** | 37 | /** |
| 38 | * 展现comp接口(推荐) | 38 | * 展现comp接口(推荐) |
| 39 | */ | 39 | */ |
| 40 | - static readonly COMP_REC_PATH: string = "api/rmrb-bff-display-zh/display/zh/c/rec/compInfo"; | 40 | + static readonly COMP_REC_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/rec/compInfo"; |
| 41 | /** | 41 | /** |
| 42 | * 详情页面详情接口 | 42 | * 详情页面详情接口 |
| 43 | */ | 43 | */ |
| @@ -135,7 +135,11 @@ export class HttpUrlUtils { | @@ -135,7 +135,11 @@ export class HttpUrlUtils { | ||
| 135 | /** | 135 | /** |
| 136 | * 我的收藏 | 136 | * 我的收藏 |
| 137 | */ | 137 | */ |
| 138 | - static readonly APPOINTMENT_MyCollectionList_PATH: string = "/api/rmrb-interact/content/zh/c/interact"; | 138 | + static readonly APPOINTMENT_MyCollectionList_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/interact"; |
| 139 | + /** | ||
| 140 | + * 收藏/取消收藏 status :收藏状态 1添加收藏 0取消收藏 | ||
| 141 | + */ | ||
| 142 | + static readonly APPOINTMENT_ExecuteCollcet_PATH: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord"; | ||
| 139 | /** | 143 | /** |
| 140 | * 个人中心 我的评论列表 | 144 | * 个人中心 我的评论列表 |
| 141 | */ | 145 | */ |
| @@ -502,7 +506,12 @@ export class HttpUrlUtils { | @@ -502,7 +506,12 @@ export class HttpUrlUtils { | ||
| 502 | } | 506 | } |
| 503 | 507 | ||
| 504 | static getMyCollectionListDataUrl() { | 508 | static getMyCollectionListDataUrl() { |
| 505 | - let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.APPOINTMENT_MyCollectionList_PATH | 509 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_MyCollectionList_PATH |
| 510 | + return url | ||
| 511 | + } | ||
| 512 | + | ||
| 513 | + static getExecuteCollcetUrl() { | ||
| 514 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH | ||
| 506 | return url | 515 | return url |
| 507 | } | 516 | } |
| 508 | 517 |
| @@ -5,6 +5,8 @@ export { BottomNavDTO } from './src/main/ets/bean/navigation/BottomNavDTO'; | @@ -5,6 +5,8 @@ export { BottomNavDTO } from './src/main/ets/bean/navigation/BottomNavDTO'; | ||
| 5 | 5 | ||
| 6 | export { TopNavDTO } from './src/main/ets/bean/navigation/TopNavDTO'; | 6 | export { TopNavDTO } from './src/main/ets/bean/navigation/TopNavDTO'; |
| 7 | 7 | ||
| 8 | +export { PageInfoDTO } from './src/main/ets/bean/navigation/PageInfoDTO'; | ||
| 9 | + | ||
| 8 | // entity | 10 | // entity |
| 9 | export { ItemDTO } from './src/main/ets/bean/ItemDTO'; | 11 | export { ItemDTO } from './src/main/ets/bean/ItemDTO'; |
| 10 | 12 |
| @@ -29,5 +29,4 @@ export interface CompDTO { | @@ -29,5 +29,4 @@ export interface CompDTO { | ||
| 29 | subType: string; | 29 | subType: string; |
| 30 | imageScale: number; // 封面图比例 1-4:3, 2-16:9, 3-3:2 | 30 | imageScale: number; // 封面图比例 1-4:3, 2-16:9, 3-3:2 |
| 31 | audioDataList: AudioDTO[]; | 31 | audioDataList: AudioDTO[]; |
| 32 | - isSelect: boolean; | ||
| 33 | } | 32 | } |
| @@ -62,11 +62,13 @@ export interface ContentDTO { | @@ -62,11 +62,13 @@ export interface ContentDTO { | ||
| 62 | // 二次请求接口,返回的数据,这里组装到content里; | 62 | // 二次请求接口,返回的数据,这里组装到content里; |
| 63 | interactData:InteractDataDTO; | 63 | interactData:InteractDataDTO; |
| 64 | 64 | ||
| 65 | - hasMore: number; | ||
| 66 | - slideShows: slideShows[]; | ||
| 67 | - voiceInfo: VoiceInfoDTO; | ||
| 68 | - tagWord: number; | 65 | + hasMore: number, |
| 66 | + slideShows: slideShows[], | ||
| 67 | + voiceInfo: VoiceInfoDTO, | ||
| 68 | + tagWord: number, | ||
| 69 | + isSelect: boolean; | ||
| 69 | rmhInfo: RmhInfoDTO; // 人民号信息 | 70 | rmhInfo: RmhInfoDTO; // 人民号信息 |
| 70 | photoNum: number; | 71 | photoNum: number; |
| 71 | 72 | ||
| 73 | + | ||
| 72 | } | 74 | } |
| 1 | +/** | ||
| 2 | + * page接口返回的Page数据DTO | ||
| 3 | + */ | ||
| 4 | +export interface PageInfoDTO { | ||
| 5 | + pageId: string; // 页面id | ||
| 6 | + id: number; // 楼层id | ||
| 7 | + name: string; // 名称 | ||
| 8 | + hasAdInfo: number; | ||
| 9 | + hasPopUp: number; | ||
| 10 | + baselineShow: number; | ||
| 11 | + groups: GroupInfoDTO[]; | ||
| 12 | + channelInfo: ChannelInfoDTO; | ||
| 13 | +} | ||
| 14 | + | ||
| 15 | +export interface ChannelInfoDTO { | ||
| 16 | + channelId: string; | ||
| 17 | + channelLevel: string; | ||
| 18 | + channelName: string; | ||
| 19 | + channelStrategy: string; | ||
| 20 | + channelStyle: string; | ||
| 21 | + pageId: string; | ||
| 22 | +} | ||
| 23 | + | ||
| 24 | +export interface GroupInfoDTO { | ||
| 25 | + blockDesc: string; | ||
| 26 | + groupStrategy: number; | ||
| 27 | + id: string; | ||
| 28 | + showType: number; | ||
| 29 | + sortValue: number; | ||
| 30 | +} |
| @@ -6,13 +6,14 @@ import { EmptyComponent } from '../view/EmptyComponent' | @@ -6,13 +6,14 @@ import { EmptyComponent } from '../view/EmptyComponent' | ||
| 6 | import { ErrorComponent } from '../view/ErrorComponent' | 6 | import { ErrorComponent } from '../view/ErrorComponent' |
| 7 | import RefreshLayout from './RefreshLayout' | 7 | import RefreshLayout from './RefreshLayout' |
| 8 | import { RefreshLayoutBean } from './RefreshLayoutBean'; | 8 | import { RefreshLayoutBean } from './RefreshLayoutBean'; |
| 9 | -import { CompDTO } from 'wdBean' | 9 | +import { CompDTO, ContentDTO } from 'wdBean' |
| 10 | import LoadMoreLayout from './LoadMoreLayout' | 10 | import LoadMoreLayout from './LoadMoreLayout' |
| 11 | import NoMoreLayout from './NoMoreLayout' | 11 | import NoMoreLayout from './NoMoreLayout' |
| 12 | import { CompParser } from '../CompParser' | 12 | import { CompParser } from '../CompParser' |
| 13 | import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; | 13 | import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; |
| 14 | import { CustomSelectUI } from '../view/CustomSelectUI'; | 14 | import { CustomSelectUI } from '../view/CustomSelectUI'; |
| 15 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; | 15 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; |
| 16 | +import { BigPicCardComponent } from '../view/BigPicCardComponent'; | ||
| 16 | 17 | ||
| 17 | @Entry | 18 | @Entry |
| 18 | @Component | 19 | @Component |
| @@ -20,8 +21,8 @@ struct BrowsingHistoryPage { | @@ -20,8 +21,8 @@ struct BrowsingHistoryPage { | ||
| 20 | @State private browSingModel: PageModel = new PageModel() | 21 | @State private browSingModel: PageModel = new PageModel() |
| 21 | isloading : boolean = false | 22 | isloading : boolean = false |
| 22 | @Provide isEditState:boolean = false | 23 | @Provide isEditState:boolean = false |
| 23 | - @State allDatas :CompDTO[] = []; | ||
| 24 | - @State selectDatas :CompDTO[] = []; | 24 | + @State allDatas :ContentDTO[] = []; |
| 25 | + @State selectDatas :ContentDTO[] = []; | ||
| 25 | @Provide deleteNum :number = 0; | 26 | @Provide deleteNum :number = 0; |
| 26 | @Provide isAllSelect:boolean = false | 27 | @Provide isAllSelect:boolean = false |
| 27 | aboutToAppear(){ | 28 | aboutToAppear(){ |
| @@ -72,7 +73,7 @@ struct BrowsingHistoryPage { | @@ -72,7 +73,7 @@ struct BrowsingHistoryPage { | ||
| 72 | }) | 73 | }) |
| 73 | } | 74 | } |
| 74 | 75 | ||
| 75 | - ForEach(this.allDatas, (compDTO: CompDTO, compIndex: number) => { | 76 | + ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => { |
| 76 | ListItem() { | 77 | ListItem() { |
| 77 | this.newCompParser(compDTO,compIndex) | 78 | this.newCompParser(compDTO,compIndex) |
| 78 | } | 79 | } |
| @@ -94,7 +95,7 @@ struct BrowsingHistoryPage { | @@ -94,7 +95,7 @@ struct BrowsingHistoryPage { | ||
| 94 | } | 95 | } |
| 95 | 96 | ||
| 96 | @Builder | 97 | @Builder |
| 97 | - newCompParser(compDTO: CompDTO, compIndex: number){ | 98 | + newCompParser(compDTO: ContentDTO, compIndex: number){ |
| 98 | Row(){ | 99 | Row(){ |
| 99 | if (this.isEditState){ | 100 | if (this.isEditState){ |
| 100 | CustomSelectUI({ | 101 | CustomSelectUI({ |
| @@ -106,7 +107,7 @@ struct BrowsingHistoryPage { | @@ -106,7 +107,7 @@ struct BrowsingHistoryPage { | ||
| 106 | .margin({left:16}) | 107 | .margin({left:16}) |
| 107 | } | 108 | } |
| 108 | Column() { | 109 | Column() { |
| 109 | - CompParser({ compDTO: compDTO, compIndex: compIndex }) | 110 | + BigPicCardComponent({contentDTO:compDTO}) |
| 110 | } | 111 | } |
| 111 | } | 112 | } |
| 112 | } | 113 | } |
| @@ -118,11 +119,11 @@ struct BrowsingHistoryPage { | @@ -118,11 +119,11 @@ struct BrowsingHistoryPage { | ||
| 118 | 119 | ||
| 119 | async getData() { | 120 | async getData() { |
| 120 | this.browSingModel.currentPage = 1 | 121 | this.browSingModel.currentPage = 1 |
| 121 | - MyCollectionViewModel.newFetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(pageDto => { | ||
| 122 | - if (pageDto && pageDto.compList && pageDto.compList.length > 0) { | 122 | + MyCollectionViewModel.fetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => { |
| 123 | + if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | ||
| 123 | this.browSingModel.viewType = ViewType.LOADED; | 124 | this.browSingModel.viewType = ViewType.LOADED; |
| 124 | - this.allDatas.push(...pageDto.compList) | ||
| 125 | - if (pageDto.compList.length === this.browSingModel.pageSize) { | 125 | + this.allDatas.push(...collectionItem.list) |
| 126 | + if (collectionItem.list.length === this.browSingModel.pageSize) { | ||
| 126 | this.browSingModel.currentPage++; | 127 | this.browSingModel.currentPage++; |
| 127 | this.browSingModel.hasMore = true; | 128 | this.browSingModel.hasMore = true; |
| 128 | } else { | 129 | } else { |
| @@ -136,7 +137,7 @@ struct BrowsingHistoryPage { | @@ -136,7 +137,7 @@ struct BrowsingHistoryPage { | ||
| 136 | 137 | ||
| 137 | //数据处理 | 138 | //数据处理 |
| 138 | //单个选择 | 139 | //单个选择 |
| 139 | - addCompDTO(isOn:boolean , compDTO: CompDTO){ | 140 | + addCompDTO(isOn:boolean , compDTO: ContentDTO){ |
| 140 | compDTO.isSelect = isOn; | 141 | compDTO.isSelect = isOn; |
| 141 | if (isOn === true){ | 142 | if (isOn === true){ |
| 142 | this.selectDatas.push(compDTO) | 143 | this.selectDatas.push(compDTO) |
| @@ -150,7 +151,7 @@ struct BrowsingHistoryPage { | @@ -150,7 +151,7 @@ struct BrowsingHistoryPage { | ||
| 150 | 151 | ||
| 151 | //全选 | 152 | //全选 |
| 152 | allSelectDatas(isOn:boolean){ | 153 | allSelectDatas(isOn:boolean){ |
| 153 | - let datas: CompDTO[] = []; | 154 | + let datas: ContentDTO[] = []; |
| 154 | for (let index = 0; index < this.allDatas.length; index++) { | 155 | for (let index = 0; index < this.allDatas.length; index++) { |
| 155 | const compDTO = this.allDatas[index]; | 156 | const compDTO = this.allDatas[index]; |
| 156 | compDTO.isSelect = isOn | 157 | compDTO.isSelect = isOn |
| @@ -42,7 +42,7 @@ struct EditUserInfoPage { | @@ -42,7 +42,7 @@ struct EditUserInfoPage { | ||
| 42 | build() { | 42 | build() { |
| 43 | Row() { | 43 | Row() { |
| 44 | Column() { | 44 | Column() { |
| 45 | - CustomTitleUI({titleName:'资料编辑'}) | 45 | + CustomTitleUI({titleName:'编辑资料'}) |
| 46 | Image(this.headerImg) | 46 | Image(this.headerImg) |
| 47 | .alt($r('app.media.default_head')) | 47 | .alt($r('app.media.default_head')) |
| 48 | .backgroundColor(Color.Gray) | 48 | .backgroundColor(Color.Gray) |
| @@ -6,13 +6,15 @@ import { EmptyComponent } from '../view/EmptyComponent' | @@ -6,13 +6,15 @@ import { EmptyComponent } from '../view/EmptyComponent' | ||
| 6 | import { ErrorComponent } from '../view/ErrorComponent' | 6 | import { ErrorComponent } from '../view/ErrorComponent' |
| 7 | import RefreshLayout from './RefreshLayout' | 7 | import RefreshLayout from './RefreshLayout' |
| 8 | import { RefreshLayoutBean } from './RefreshLayoutBean'; | 8 | import { RefreshLayoutBean } from './RefreshLayoutBean'; |
| 9 | -import { CompDTO } from 'wdBean' | 9 | +import { CompDTO, ContentDTO } from 'wdBean' |
| 10 | import LoadMoreLayout from './LoadMoreLayout' | 10 | import LoadMoreLayout from './LoadMoreLayout' |
| 11 | import NoMoreLayout from './NoMoreLayout' | 11 | import NoMoreLayout from './NoMoreLayout' |
| 12 | import { CompParser } from '../CompParser' | 12 | import { CompParser } from '../CompParser' |
| 13 | import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; | 13 | import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; |
| 14 | import { CustomSelectUI } from '../view/CustomSelectUI'; | 14 | import { CustomSelectUI } from '../view/CustomSelectUI'; |
| 15 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; | 15 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; |
| 16 | +import { BigPicCardComponent } from '../view/BigPicCardComponent'; | ||
| 17 | +import { contentListItemParams } from '../../model/MyCollectionModel'; | ||
| 16 | 18 | ||
| 17 | @Entry | 19 | @Entry |
| 18 | @Component | 20 | @Component |
| @@ -20,8 +22,8 @@ struct MyCollectionListPage { | @@ -20,8 +22,8 @@ struct MyCollectionListPage { | ||
| 20 | @State private browSingModel: PageModel = new PageModel() | 22 | @State private browSingModel: PageModel = new PageModel() |
| 21 | isloading : boolean = false | 23 | isloading : boolean = false |
| 22 | @Provide isEditState:boolean = false | 24 | @Provide isEditState:boolean = false |
| 23 | - @State allDatas :CompDTO[] = []; | ||
| 24 | - @State selectDatas :CompDTO[] = []; | 25 | + @State allDatas :ContentDTO[] = []; |
| 26 | + @State selectDatas :ContentDTO[] = []; | ||
| 25 | @Provide deleteNum :number = 0; | 27 | @Provide deleteNum :number = 0; |
| 26 | @Provide isAllSelect:boolean = false | 28 | @Provide isAllSelect:boolean = false |
| 27 | aboutToAppear(){ | 29 | aboutToAppear(){ |
| @@ -72,7 +74,7 @@ struct MyCollectionListPage { | @@ -72,7 +74,7 @@ struct MyCollectionListPage { | ||
| 72 | }) | 74 | }) |
| 73 | } | 75 | } |
| 74 | 76 | ||
| 75 | - ForEach(this.allDatas, (compDTO: CompDTO, compIndex: number) => { | 77 | + ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => { |
| 76 | ListItem() { | 78 | ListItem() { |
| 77 | this.newCompParser(compDTO,compIndex) | 79 | this.newCompParser(compDTO,compIndex) |
| 78 | } | 80 | } |
| @@ -94,7 +96,7 @@ struct MyCollectionListPage { | @@ -94,7 +96,7 @@ struct MyCollectionListPage { | ||
| 94 | } | 96 | } |
| 95 | 97 | ||
| 96 | @Builder | 98 | @Builder |
| 97 | - newCompParser(compDTO: CompDTO, compIndex: number){ | 99 | + newCompParser(compDTO: ContentDTO, compIndex: number){ |
| 98 | Row(){ | 100 | Row(){ |
| 99 | if (this.isEditState){ | 101 | if (this.isEditState){ |
| 100 | CustomSelectUI({ | 102 | CustomSelectUI({ |
| @@ -106,7 +108,7 @@ struct MyCollectionListPage { | @@ -106,7 +108,7 @@ struct MyCollectionListPage { | ||
| 106 | .margin({left:16}) | 108 | .margin({left:16}) |
| 107 | } | 109 | } |
| 108 | Column() { | 110 | Column() { |
| 109 | - CompParser({ compDTO: compDTO, compIndex: compIndex }) | 111 | + BigPicCardComponent({contentDTO:compDTO}) |
| 110 | } | 112 | } |
| 111 | } | 113 | } |
| 112 | } | 114 | } |
| @@ -118,11 +120,11 @@ struct MyCollectionListPage { | @@ -118,11 +120,11 @@ struct MyCollectionListPage { | ||
| 118 | 120 | ||
| 119 | async getData() { | 121 | async getData() { |
| 120 | this.browSingModel.currentPage = 1 | 122 | this.browSingModel.currentPage = 1 |
| 121 | - MyCollectionViewModel.newFetchMyCollectList(1,'1',this.browSingModel.currentPage,getContext(this)).then(pageDto => { | ||
| 122 | - if (pageDto && pageDto.compList && pageDto.compList.length > 0) { | 123 | + MyCollectionViewModel.fetchMyCollectList(1,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => { |
| 124 | + if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | ||
| 123 | this.browSingModel.viewType = ViewType.LOADED; | 125 | this.browSingModel.viewType = ViewType.LOADED; |
| 124 | - this.allDatas.push(...pageDto.compList) | ||
| 125 | - if (pageDto.compList.length === this.browSingModel.pageSize) { | 126 | + this.allDatas.push(...collectionItem.list) |
| 127 | + if (collectionItem.list.length === this.browSingModel.pageSize) { | ||
| 126 | this.browSingModel.currentPage++; | 128 | this.browSingModel.currentPage++; |
| 127 | this.browSingModel.hasMore = true; | 129 | this.browSingModel.hasMore = true; |
| 128 | } else { | 130 | } else { |
| @@ -136,7 +138,7 @@ struct MyCollectionListPage { | @@ -136,7 +138,7 @@ struct MyCollectionListPage { | ||
| 136 | 138 | ||
| 137 | //数据处理 | 139 | //数据处理 |
| 138 | //单个选择 | 140 | //单个选择 |
| 139 | - addCompDTO(isOn:boolean , compDTO: CompDTO){ | 141 | + addCompDTO(isOn:boolean , compDTO: ContentDTO){ |
| 140 | compDTO.isSelect = isOn; | 142 | compDTO.isSelect = isOn; |
| 141 | if (isOn === true){ | 143 | if (isOn === true){ |
| 142 | this.selectDatas.push(compDTO) | 144 | this.selectDatas.push(compDTO) |
| @@ -150,7 +152,7 @@ struct MyCollectionListPage { | @@ -150,7 +152,7 @@ struct MyCollectionListPage { | ||
| 150 | 152 | ||
| 151 | //全选 | 153 | //全选 |
| 152 | allSelectDatas(isOn:boolean){ | 154 | allSelectDatas(isOn:boolean){ |
| 153 | - let datas: CompDTO[] = []; | 155 | + let datas: ContentDTO[] = []; |
| 154 | for (let index = 0; index < this.allDatas.length; index++) { | 156 | for (let index = 0; index < this.allDatas.length; index++) { |
| 155 | const compDTO = this.allDatas[index]; | 157 | const compDTO = this.allDatas[index]; |
| 156 | compDTO.isSelect = isOn | 158 | compDTO.isSelect = isOn |
| @@ -169,13 +171,22 @@ struct MyCollectionListPage { | @@ -169,13 +171,22 @@ struct MyCollectionListPage { | ||
| 169 | 171 | ||
| 170 | //删除 | 172 | //删除 |
| 171 | deleteDatas(){ | 173 | deleteDatas(){ |
| 174 | + let deleteDatas:contentListItemParams[] = []; | ||
| 172 | for (let index = 0; index < this.selectDatas.length; index++) { | 175 | for (let index = 0; index < this.selectDatas.length; index++) { |
| 173 | - const compDTO = this.allDatas[index]; | ||
| 174 | - this.allDatas.splice(this.selectDatas.indexOf(compDTO),1) | 176 | + const compDTO = this.selectDatas[index]; |
| 177 | + this.allDatas.splice(this.allDatas.indexOf(compDTO),1) | ||
| 178 | + deleteDatas.push({contentId:compDTO.objectId,contentType:compDTO.objectType,relType:compDTO.relType,contentRelId:compDTO.relId}) | ||
| 175 | } | 179 | } |
| 176 | 180 | ||
| 181 | + MyCollectionViewModel.executeCollcet({ | ||
| 182 | + delAll:this.isAllSelect === true?1:0, | ||
| 183 | + status:0, | ||
| 184 | + contentList:deleteDatas | ||
| 185 | + }) | ||
| 186 | + | ||
| 177 | //重置删除状态 | 187 | //重置删除状态 |
| 178 | this.isEditState = false | 188 | this.isEditState = false |
| 179 | this.isAllSelect = false | 189 | this.isAllSelect = false |
| 180 | } | 190 | } |
| 191 | + | ||
| 181 | } | 192 | } |
| 1 | + | ||
| 2 | +import { Logger, DateTimeUtils, CollectionUtils } from 'wdKit'; | ||
| 1 | import { CommonConstants, CompStyle, ViewType } from 'wdConstant'; | 3 | import { CommonConstants, CompStyle, ViewType } from 'wdConstant'; |
| 2 | -import { DateTimeUtils, Logger } from 'wdKit'; | ||
| 3 | import PageViewModel from '../../viewmodel/PageViewModel'; | 4 | import PageViewModel from '../../viewmodel/PageViewModel'; |
| 4 | import { EmptyComponent } from '../view/EmptyComponent'; | 5 | import { EmptyComponent } from '../view/EmptyComponent'; |
| 5 | import { ErrorComponent } from '../view/ErrorComponent'; | 6 | import { ErrorComponent } from '../view/ErrorComponent'; |
| @@ -11,8 +12,10 @@ import NoMoreLayout from './NoMoreLayout'; | @@ -11,8 +12,10 @@ import NoMoreLayout from './NoMoreLayout'; | ||
| 11 | import LoadMoreLayout from './LoadMoreLayout'; | 12 | import LoadMoreLayout from './LoadMoreLayout'; |
| 12 | import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; | 13 | import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; |
| 13 | import { CompParser } from '../CompParser'; | 14 | import { CompParser } from '../CompParser'; |
| 15 | +import { GroupInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO'; | ||
| 14 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; | 16 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; |
| 15 | -import { CompDTO, LiveReviewDTO, PageDTO } from 'wdBean'; | 17 | +import { CompDTO, LiveReviewDTO, PageDTO ,PageInfoDTO} from 'wdBean'; |
| 18 | + | ||
| 16 | 19 | ||
| 17 | const TAG = 'PageComponent'; | 20 | const TAG = 'PageComponent'; |
| 18 | 21 | ||
| @@ -155,11 +158,14 @@ export struct PageComponent { | @@ -155,11 +158,14 @@ export struct PageComponent { | ||
| 155 | this.pageModel.viewType = ViewType.EMPTY; | 158 | this.pageModel.viewType = ViewType.EMPTY; |
| 156 | return; | 159 | return; |
| 157 | } | 160 | } |
| 158 | - Logger.debug(TAG, 'getPageUrlData ' + pageInfo.id); | 161 | + let groupInfo: GroupInfoDTO = CollectionUtils.getElement(pageInfo.groups, 0); |
| 162 | + if (groupInfo != null) { | ||
| 163 | + this.pageModel.isRecGroup = groupInfo.groupStrategy === 1; | ||
| 164 | + this.pageModel.groupId = groupInfo.id; | ||
| 165 | + } | ||
| 159 | // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代 | 166 | // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代 |
| 160 | - for (const group of pageInfo.groups) { | ||
| 161 | - this.pageDto = await PageViewModel.getPageData(this.pageModel.pageId, `${group.id}`, this.pageModel.channelId | ||
| 162 | - , this.pageModel.currentPage, this.pageModel.pageSize,group.groupStrategy, getContext(this)) | 167 | + // for (const group of pageInfo.groups) { |
| 168 | + this.pageDto = await PageViewModel.getPageData(this.pageModel, getContext(this)) | ||
| 163 | this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | 169 | this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() |
| 164 | if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) { | 170 | if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) { |
| 165 | this.pageDto.compList.forEach((comp) => { | 171 | this.pageDto.compList.forEach((comp) => { |
| @@ -184,42 +190,12 @@ export struct PageComponent { | @@ -184,42 +190,12 @@ export struct PageComponent { | ||
| 184 | // }) | 190 | // }) |
| 185 | this.isFirstIn = false | 191 | this.isFirstIn = false |
| 186 | Logger.debug(TAG, 'cj111'); | 192 | Logger.debug(TAG, 'cj111'); |
| 187 | - } else { | ||
| 188 | - Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.'); | ||
| 189 | - this.pageModel.viewType = ViewType.EMPTY; | ||
| 190 | - } | 193 | + // } else { |
| 194 | + // Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.'); | ||
| 195 | + // this.pageModel.viewType = ViewType.EMPTY; | ||
| 196 | + // } | ||
| 191 | } | 197 | } |
| 192 | 198 | ||
| 193 | - // this.isFirstIn = false | ||
| 194 | - // let groupInfo: Group = CollectionUtils.getElement(pageInfo.groups, 0); | ||
| 195 | - // if (groupInfo != null) { | ||
| 196 | - // this.pageModel.groupStrategy = groupInfo.groupStrategy; | ||
| 197 | - // this.pageModel.isRecGroup = groupInfo.groupStrategy === 1; | ||
| 198 | - // this.pageModel.groupId = "" + groupInfo.id; | ||
| 199 | - // } | ||
| 200 | - // let pageDto = await PageViewModel.getPageData(this.pageModel.pageId, this.pageModel.pageId, this.pageModel.channelId | ||
| 201 | - // , this.pageModel.currentPage, this.pageModel.pageSize, getContext(this)) | ||
| 202 | - // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 203 | - // if (pageDto && pageDto.compList && pageDto.compList.length > 0) { | ||
| 204 | - // this.pageModel.viewType = ViewType.LOADED; | ||
| 205 | - // this.pageModel.compList.push(...pageDto.compList) | ||
| 206 | - // if (pageDto.compList.length === this.pageModel.pageSize) { | ||
| 207 | - // this.pageModel.currentPage++; | ||
| 208 | - // this.pageModel.hasMore = true; | ||
| 209 | - // } else { | ||
| 210 | - // this.pageModel.hasMore = false; | ||
| 211 | - // } | ||
| 212 | - // // 二次请求,批查互动数据 | ||
| 213 | - // PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => { | ||
| 214 | - // // 刷新,替换所有数据 | ||
| 215 | - // this.pageModel.compList.replaceAll(...data) | ||
| 216 | - // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 217 | - // }) | ||
| 218 | - // } else { | ||
| 219 | - // Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.'); | ||
| 220 | - // this.pageModel.viewType = ViewType.EMPTY; | ||
| 221 | - // } | ||
| 222 | - | ||
| 223 | } | 199 | } |
| 224 | 200 | ||
| 225 | async getPreviewData() { | 201 | async getPreviewData() { |
| @@ -19,8 +19,10 @@ export struct BigPicCardComponent { | @@ -19,8 +19,10 @@ export struct BigPicCardComponent { | ||
| 19 | 19 | ||
| 20 | aboutToAppear() { | 20 | aboutToAppear() { |
| 21 | // 取第一个数据 | 21 | // 取第一个数据 |
| 22 | - this.contentDTO = this.compDTO.operDataList[0]; | ||
| 23 | - this.contentDTO.appStyle = "2"; | 22 | + if (this.compDTO.operDataList) { |
| 23 | + this.contentDTO = this.compDTO.operDataList[0]; | ||
| 24 | + this.contentDTO.appStyle = "2"; | ||
| 25 | + } | ||
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | build() { | 28 | build() { |
| 1 | -import { Logger } from 'wdKit'; | ||
| 2 | import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel'; | 1 | import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel'; |
| 3 | -import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel'; | ||
| 4 | import { FirstLevelComponent } from './FirstLevelComponent'; | 2 | import { FirstLevelComponent } from './FirstLevelComponent'; |
| 5 | import { SecondLevelComponent } from './SecondLevelComponent'; | 3 | import { SecondLevelComponent } from './SecondLevelComponent'; |
| 6 | import { ThirdLevelComponent } from './ThirdLevelComponent'; | 4 | import { ThirdLevelComponent } from './ThirdLevelComponent'; |
| 7 | @CustomDialog | 5 | @CustomDialog |
| 6 | + | ||
| 8 | export struct AreaPickerDialog { | 7 | export struct AreaPickerDialog { |
| 9 | @Provide currentFirst: AreaListManageModel = new AreaListManageModel('','','',[]) | 8 | @Provide currentFirst: AreaListManageModel = new AreaListManageModel('','','',[]) |
| 10 | @Provide currentSecondBean: AreaListManageModel = new AreaListManageModel('','','',[]) | 9 | @Provide currentSecondBean: AreaListManageModel = new AreaListManageModel('','','',[]) |
| 1 | +import { ContentDTO } from 'wdBean/Index'; | ||
| 1 | 2 | ||
| 2 | // { | 3 | // { |
| 3 | // "hasNext": 0, | 4 | // "hasNext": 0, |
| @@ -22,24 +23,38 @@ export class MyCollectionModel{ | @@ -22,24 +23,38 @@ export class MyCollectionModel{ | ||
| 22 | } | 23 | } |
| 23 | } | 24 | } |
| 24 | 25 | ||
| 25 | -@Observed | ||
| 26 | -export class MyCollectionItem{ | 26 | +export class MyCollectionItem{ |
| 27 | pageNum:number = 0 | 27 | pageNum:number = 0 |
| 28 | pageSize:number = 0 | 28 | pageSize:number = 0 |
| 29 | totalCount:number = 0 | 29 | totalCount:number = 0 |
| 30 | hasNext:number = 0 | 30 | hasNext:number = 0 |
| 31 | - list:MyCollectionModel[] = [] | 31 | + list:ContentDTO[] = [] |
| 32 | + | ||
| 33 | + constructor(list?:ContentDTO[],pageNum?: number,pageSize?: number,totalCount?: number,hasNext?:number) { | ||
| 34 | + } | ||
| 32 | } | 35 | } |
| 33 | 36 | ||
| 37 | +export interface MyCollectionListModel{ | ||
| 38 | + data: MyCollectionItem | ||
| 39 | + code: number | ||
| 40 | + message: string | ||
| 41 | + success: string | ||
| 42 | + timestamp: number | ||
| 43 | +} | ||
| 34 | 44 | ||
| 35 | -export class MyCollectionListModel{ | ||
| 36 | - list:MyCollectionModel[] = [] | ||
| 37 | 45 | ||
| 38 | - pageNum: number = 0 | ||
| 39 | - pageSize: number = 20 | ||
| 40 | - totalCount: number = 0 | ||
| 41 | 46 | ||
| 42 | - constructor(list?:MyCollectionModel[],pageNum?: number,pageSize?: number,totalCount?: number) { | ||
| 43 | - } | 47 | +export interface contentListItemParams{ |
| 48 | + contentId?:string; | ||
| 49 | + contentType?:string; | ||
| 50 | + relType?:string; | ||
| 51 | + contentRelId?:string; | ||
| 44 | } | 52 | } |
| 45 | 53 | ||
| 54 | +export interface collcetRecordParams { | ||
| 55 | + delAll?: number; | ||
| 56 | + | ||
| 57 | + status?: number; | ||
| 58 | + | ||
| 59 | + contentList?: contentListItemParams[]; | ||
| 60 | +} |
| @@ -6,7 +6,6 @@ import { | @@ -6,7 +6,6 @@ import { | ||
| 6 | CompInfoBean, | 6 | CompInfoBean, |
| 7 | ContentDetailDTO, | 7 | ContentDetailDTO, |
| 8 | ContentDTO, | 8 | ContentDTO, |
| 9 | - contentListParams, | ||
| 10 | InteractDataDTO, | 9 | InteractDataDTO, |
| 11 | LiveReviewDTO, | 10 | LiveReviewDTO, |
| 12 | MorningEveningPaperDTO, | 11 | MorningEveningPaperDTO, |
| @@ -18,6 +17,8 @@ import { | @@ -18,6 +17,8 @@ import { | ||
| 18 | postBatchAttentionStatusParams, | 17 | postBatchAttentionStatusParams, |
| 19 | postBatchAttentionStatusResult, | 18 | postBatchAttentionStatusResult, |
| 20 | postExecuteCollectRecordParams, | 19 | postExecuteCollectRecordParams, |
| 20 | + contentListParams, | ||
| 21 | + PageInfoDTO, | ||
| 21 | postExecuteLikeParams, | 22 | postExecuteLikeParams, |
| 22 | postInteractAccentionOperateParams, | 23 | postInteractAccentionOperateParams, |
| 23 | postRecommendListParams | 24 | postRecommendListParams |
| @@ -185,9 +186,15 @@ export class PageRepository { | @@ -185,9 +186,15 @@ export class PageRepository { | ||
| 185 | let url = PageRepository.getPageUrl(pageId) | 186 | let url = PageRepository.getPageUrl(pageId) |
| 186 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | 187 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); |
| 187 | return WDHttp.get<ResponseDTO<PageInfoBean>>(url, headers) | 188 | return WDHttp.get<ResponseDTO<PageInfoBean>>(url, headers) |
| 189 | + } | ||
| 190 | + | ||
| 191 | + static fetchPageData(pageId: string) { | ||
| 192 | + let url = PageRepository.getPageInfoUrl(pageId) | ||
| 193 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 194 | + return WDHttp.get<ResponseDTO<PageInfoDTO>>(url, headers) | ||
| 188 | }; | 195 | }; |
| 189 | 196 | ||
| 190 | - static fetchPageData(pageId: string, groupId: string, channelId: string,groupStrategy:number, currentPage: number, pageSize: number) { | 197 | + static fetchCompData(pageId: string, groupId: string, channelId: string,groupStrategy:number, currentPage: number, pageSize: number) { |
| 191 | let url = PageRepository.getCompInfoUrl(pageId, groupId, channelId,groupStrategy, currentPage, pageSize) | 198 | let url = PageRepository.getCompInfoUrl(pageId, groupId, channelId,groupStrategy, currentPage, pageSize) |
| 192 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | 199 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); |
| 193 | return WDHttp.get<ResponseDTO<PageDTO>>(url, headers) | 200 | return WDHttp.get<ResponseDTO<PageDTO>>(url, headers) |
| @@ -71,8 +71,7 @@ export function touchUpPullRefresh(pageModel: PageModel) { | @@ -71,8 +71,7 @@ export function touchUpPullRefresh(pageModel: PageModel) { | ||
| 71 | pageModel.currentPage = 1; | 71 | pageModel.currentPage = 1; |
| 72 | setTimeout(() => { | 72 | setTimeout(() => { |
| 73 | let self: PageModel = pageModel; | 73 | let self: PageModel = pageModel; |
| 74 | - | ||
| 75 | - PageViewModel.getPageData(self.pageId, self.groupId, self.channelId, self.currentPage, self.pageSize,self.groupStrategy, getContext()) | 74 | + PageViewModel.getPageData(self, getContext()) |
| 76 | .then((data: PageDTO) => { | 75 | .then((data: PageDTO) => { |
| 77 | self.timestamp = DateTimeUtils.getTimeStamp().toString() | 76 | self.timestamp = DateTimeUtils.getTimeStamp().toString() |
| 78 | if (data == null || data.compList == null || data.compList.length == 0) { | 77 | if (data == null || data.compList == null || data.compList.length == 0) { |
| @@ -28,7 +28,7 @@ export function touchUpLoadMore(model: PageModel) { | @@ -28,7 +28,7 @@ export function touchUpLoadMore(model: PageModel) { | ||
| 28 | self.isLoading = true; | 28 | self.isLoading = true; |
| 29 | setTimeout(() => { | 29 | setTimeout(() => { |
| 30 | closeLoadMore(model); | 30 | closeLoadMore(model); |
| 31 | - PageViewModel.getPageData(self.pageId, self.groupId, self.channelId, self.currentPage, self.pageSize,self.groupStrategy, getContext()) | 31 | + PageViewModel.getPageData(self, getContext()) |
| 32 | .then((data: PageDTO) => { | 32 | .then((data: PageDTO) => { |
| 33 | self.timestamp = DateTimeUtils.getTimeStamp().toString() | 33 | self.timestamp = DateTimeUtils.getTimeStamp().toString() |
| 34 | if (data == null || data.compList == null || data.compList.length == 0) { | 34 | if (data == null || data.compList == null || data.compList.length == 0) { |
| 1 | -import { MyCollectionListModel } from '../model/MyCollectionModel'; | 1 | +import { collcetRecordParams, MyCollectionItem, MyCollectionListModel } from '../model/MyCollectionModel'; |
| 2 | import HashMap from '@ohos.util.HashMap'; | 2 | import HashMap from '@ohos.util.HashMap'; |
| 3 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 3 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 4 | import { Logger, ResourcesUtils } from 'wdKit'; | 4 | import { Logger, ResourcesUtils } from 'wdKit'; |
| 5 | import { PageDTO } from 'wdBean'; | 5 | import { PageDTO } from 'wdBean'; |
| 6 | +import promptAction from '@ohos.promptAction'; | ||
| 6 | 7 | ||
| 7 | const TAG = "MyCollectionViewModel" | 8 | const TAG = "MyCollectionViewModel" |
| 8 | 9 | ||
| 9 | class MyCollectionViewModel { | 10 | class MyCollectionViewModel { |
| 10 | private static instance:MyCollectionViewModel | 11 | private static instance:MyCollectionViewModel |
| 11 | - | ||
| 12 | /** | 12 | /** |
| 13 | * 单例模式 | 13 | * 单例模式 |
| 14 | * @returns | 14 | * @returns |
| @@ -20,84 +20,48 @@ class MyCollectionViewModel { | @@ -20,84 +20,48 @@ class MyCollectionViewModel { | ||
| 20 | return MyCollectionViewModel.instance; | 20 | return MyCollectionViewModel.instance; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | - BaseGetRequest(type:number,tagId:string,pageNum:string){ | ||
| 24 | - let url = HttpUrlUtils.getMyCollectionListDataUrl()+ `?type=${type}&operateTag=${1}&pageSize=${20}&pageNum=${pageNum}` | ||
| 25 | - if (tagId.length > 0) { | ||
| 26 | - url = url + `&tagId=${tagId}` | ||
| 27 | - } | 23 | + //Type 1 收藏 2 浏览历史 |
| 24 | + //tagId 收藏界面 标签筛选 | ||
| 25 | + BaseGetRequest(type:number,tagId:string,pageNum:number){ | ||
| 26 | + let url = HttpUrlUtils.getMyCollectionListDataUrl()+ `?type=${type}&operateTag=${2}&pageSize=${20}&pageNum=${pageNum.toString()}` | ||
| 27 | + // if (tagId.length > 0) { | ||
| 28 | + // url = url + `&tagId=${tagId}` | ||
| 29 | + // } | ||
| 28 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders() | 30 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders() |
| 29 | - return WDHttp.get<ResponseDTO<MyCollectionListModel>>(url, headers) | 31 | + return WDHttp.get<MyCollectionListModel>(url, headers) |
| 30 | } | 32 | } |
| 31 | 33 | ||
| 32 | - async getAppointmentListDataLocal(context: Context): Promise<MyCollectionListModel> { | ||
| 33 | - Logger.info(TAG, `getBottomNavDataMock start`); | ||
| 34 | - let compRes: ResponseDTO<MyCollectionListModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MyCollectionListModel>>(context,'browsingHistory_list_data.json' ); | ||
| 35 | - if (!compRes || !compRes.data) { | ||
| 36 | - Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`); | ||
| 37 | - return new MyCollectionListModel() | ||
| 38 | - } | ||
| 39 | - Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 40 | - return compRes.data | ||
| 41 | - } | ||
| 42 | 34 | ||
| 43 | - //Type 1 收藏 2 浏览历史 | ||
| 44 | - //tagId 收藏界面 标签筛选 | ||
| 45 | - fetchMyCollectList(type:number,tagId:string,pageNum:string,context: Context):Promise<MyCollectionListModel>{ | ||
| 46 | - return new Promise<MyCollectionListModel>((success,error) => { | ||
| 47 | - this.BaseGetRequest(type,tagId,pageNum).then((navResDTO: ResponseDTO<MyCollectionListModel>) => { | 35 | + fetchMyCollectList(type:number,tagId:string,pageNum:number,context: Context):Promise<MyCollectionItem>{ |
| 36 | + return new Promise((success,error) => { | ||
| 37 | + this.BaseGetRequest(type,tagId,pageNum).then((navResDTO: MyCollectionListModel) => { | ||
| 48 | if (!navResDTO || navResDTO.code != 0) { | 38 | if (!navResDTO || navResDTO.code != 0) { |
| 49 | - success(this.getAppointmentListDataLocal(context)) | ||
| 50 | return | 39 | return |
| 51 | } | 40 | } |
| 52 | - Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | ||
| 53 | - let listData = navResDTO.data as MyCollectionListModel | ||
| 54 | - success(listData) | 41 | + Logger.info(TAG, "fetchMyCollectList then,navResDTO.timeStamp:" + navResDTO.timestamp); |
| 42 | + success(navResDTO.data) | ||
| 55 | }).catch((err: Error) => { | 43 | }).catch((err: Error) => { |
| 56 | - Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | 44 | + Logger.error(TAG, `fetchMyCollectList catch, error.name : ${err.name}, error.message:${err.message}`); |
| 57 | error("page data invalid"); | 45 | error("page data invalid"); |
| 58 | }) | 46 | }) |
| 59 | }) | 47 | }) |
| 60 | } | 48 | } |
| 61 | 49 | ||
| 62 | - | ||
| 63 | - newBaseGetRequest(type:number,tagId:string,pageNum:number){ | ||
| 64 | - let url = HttpUrlUtils.getMyCollectionListDataUrl()+ `?type=${type}&operateTag=${1}&pageSize=${20}&pageNum=${pageNum.toString()}` | ||
| 65 | - if (tagId.length > 0) { | ||
| 66 | - url = url + `&tagId=${tagId}` | ||
| 67 | - } | ||
| 68 | - let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders() | ||
| 69 | - return WDHttp.get<ResponseDTO<PageDTO>>(url, headers) | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - newFetchMyCollectList(type:number,tagId:string,pageNum:number,context: Context):Promise<PageDTO>{ | ||
| 73 | - return new Promise<PageDTO>((success,error) => { | ||
| 74 | - success(this.newGetAppointmentListDataLocal(type,context)) | ||
| 75 | - return | ||
| 76 | - this.newBaseGetRequest(type,tagId,pageNum).then((navResDTO: ResponseDTO<PageDTO>) => { | ||
| 77 | - if (!navResDTO || navResDTO.code != 0) { | ||
| 78 | - success(this.newGetAppointmentListDataLocal(type,context)) | ||
| 79 | - return | 50 | + //收藏/取消收藏 status :收藏状态 1添加收藏 0取消收藏 |
| 51 | + executeCollcet(params: collcetRecordParams):Promise<ResponseDTO>{ | ||
| 52 | + return new Promise(() => { | ||
| 53 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders() | ||
| 54 | + WDHttp.post<ResponseDTO>(HttpUrlUtils.getExecuteCollcetUrl(),params,headers).then((navResDTO: ResponseDTO) => { | ||
| 55 | + if (navResDTO.code == 0) { | ||
| 56 | + promptAction.showToast({ message: '删除成功' }) | ||
| 80 | } | 57 | } |
| 81 | - Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | ||
| 82 | - let listData = navResDTO.data as PageDTO | ||
| 83 | - success(listData) | ||
| 84 | - }).catch((err: Error) => { | ||
| 85 | - Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 86 | - error("page data invalid"); | ||
| 87 | }) | 58 | }) |
| 59 | + .catch((error: Error) => { | ||
| 60 | + Logger.info(TAG,'executeCollcet','ResponseDTO') | ||
| 61 | + }) | ||
| 88 | }) | 62 | }) |
| 89 | } | 63 | } |
| 90 | 64 | ||
| 91 | - async newGetAppointmentListDataLocal(type:number, context: Context): Promise<PageDTO> { | ||
| 92 | - Logger.info(TAG, `getBottomNavDataMock start`); | ||
| 93 | - let compRes: ResponseDTO<PageDTO> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context,type == 1?'MyCollection_list_data.json':'browsingHistory_list_data.json'); | ||
| 94 | - if (!compRes || !compRes.data) { | ||
| 95 | - Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`); | ||
| 96 | - return {} as PageDTO | ||
| 97 | - } | ||
| 98 | - Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | ||
| 99 | - return compRes.data | ||
| 100 | - } | ||
| 101 | } | 65 | } |
| 102 | 66 | ||
| 103 | const collectionViewModel = MyCollectionViewModel.getInstance(); | 67 | const collectionViewModel = MyCollectionViewModel.getInstance(); |
| @@ -8,6 +8,7 @@ export default class PageModel { | @@ -8,6 +8,7 @@ export default class PageModel { | ||
| 8 | pageId: string = ""; | 8 | pageId: string = ""; |
| 9 | groupId: string = ""; | 9 | groupId: string = ""; |
| 10 | channelId: string = ""; | 10 | channelId: string = ""; |
| 11 | + isRecGroup: boolean = false; | ||
| 11 | compList: LazyDataSource<CompDTO> = new LazyDataSource(); | 12 | compList: LazyDataSource<CompDTO> = new LazyDataSource(); |
| 12 | // 页面状态,刷新、加载更多等 | 13 | // 页面状态,刷新、加载更多等 |
| 13 | currentPage: number = 1; | 14 | currentPage: number = 1; |
| @@ -35,5 +36,4 @@ export default class PageModel { | @@ -35,5 +36,4 @@ export default class PageModel { | ||
| 35 | // keyGenerator相关字符串,用于刷新list布局 | 36 | // keyGenerator相关字符串,用于刷新list布局 |
| 36 | timestamp: String = '1'; | 37 | timestamp: String = '1'; |
| 37 | groupStrategy: number = 0; | 38 | groupStrategy: number = 0; |
| 38 | - isRecGroup: boolean = false; | ||
| 39 | } | 39 | } |
| @@ -7,13 +7,16 @@ import { | @@ -7,13 +7,16 @@ import { | ||
| 7 | MorningEveningPaperDTO, | 7 | MorningEveningPaperDTO, |
| 8 | NavigationBodyDTO, | 8 | NavigationBodyDTO, |
| 9 | PageDTO, | 9 | PageDTO, |
| 10 | - PageInfoBean | 10 | + PageInfoBean, |
| 11 | + PageInfoDTO | ||
| 11 | } from 'wdBean'; | 12 | } from 'wdBean'; |
| 12 | 13 | ||
| 14 | + | ||
| 13 | import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit'; | 15 | import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit'; |
| 14 | import { ResponseDTO, } from 'wdNetwork'; | 16 | import { ResponseDTO, } from 'wdNetwork'; |
| 15 | import { PageRepository } from '../repository/PageRepository'; | 17 | import { PageRepository } from '../repository/PageRepository'; |
| 16 | import { BaseViewModel } from './BaseViewModel'; | 18 | import { BaseViewModel } from './BaseViewModel'; |
| 19 | +import PageModel from './PageModel'; | ||
| 17 | 20 | ||
| 18 | const TAG = 'PageViewModel'; | 21 | const TAG = 'PageViewModel'; |
| 19 | /** | 22 | /** |
| @@ -140,14 +143,14 @@ export class PageViewModel extends BaseViewModel { | @@ -140,14 +143,14 @@ export class PageViewModel extends BaseViewModel { | ||
| 140 | return compRes.data | 143 | return compRes.data |
| 141 | } | 144 | } |
| 142 | 145 | ||
| 143 | - async getPageData(pageId: string, groupId: string, channelId: string, currentPage: number | ||
| 144 | - , pageSize: number,groupStrategy:number, context: Context): Promise<PageDTO> { | ||
| 145 | - Logger.debug(TAG, 'getPageData pageId: ' + pageId); | ||
| 146 | - if (mock_switch) { | ||
| 147 | - return this.getPageData1(currentPage, context); | ||
| 148 | - } | 146 | + async getPageData(pageModel: PageModel, context?: Context): Promise<PageDTO> { |
| 147 | + Logger.debug(TAG, 'getPageData pageId: ' + pageModel.pageId); | ||
| 148 | + return this.parseComp(PageRepository.fetchCompData(pageModel.pageId, pageModel.groupId, pageModel.channelId, pageModel.isRecGroup==true?1:0,pageModel.currentPage, pageModel.pageSize)) | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + private parseComp(getData: Promise<ResponseDTO<PageDTO>>): Promise<PageDTO> { | ||
| 149 | return new Promise<PageDTO>((success, error) => { | 152 | return new Promise<PageDTO>((success, error) => { |
| 150 | - PageRepository.fetchPageData(pageId, groupId, channelId,groupStrategy, currentPage, pageSize) | 153 | + getData |
| 151 | .then((resDTO: ResponseDTO<PageDTO>) => { | 154 | .then((resDTO: ResponseDTO<PageDTO>) => { |
| 152 | if (!resDTO || !resDTO.data) { | 155 | if (!resDTO || !resDTO.data) { |
| 153 | Logger.error(TAG, 'getNavData then resDTO is empty'); | 156 | Logger.error(TAG, 'getNavData then resDTO is empty'); |
-
Please register or login to post a comment