Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
17 changed files
with
381 additions
and
71 deletions
| @@ -28,5 +28,6 @@ export interface CompDTO { | @@ -28,5 +28,6 @@ export interface CompDTO { | ||
| 28 | sortValue: number; | 28 | sortValue: number; |
| 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; | ||
| 32 | } | 33 | } |
| 1 | -import { CustomTitleUI } from '../reusable/CustomTitleUI' | 1 | +import { CustomTitleAndEditUI } from '../reusable/CustomTitleAndEditUI' |
| 2 | import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel'; | 2 | import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel'; |
| 3 | import PageModel from '../../viewmodel/PageModel'; | 3 | import PageModel from '../../viewmodel/PageModel'; |
| 4 | import { CommonConstants, ViewType } from 'wdConstant' | 4 | import { CommonConstants, ViewType } from 'wdConstant' |
| @@ -11,20 +11,31 @@ import LoadMoreLayout from './LoadMoreLayout' | @@ -11,20 +11,31 @@ 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 { listTouchEvent } from '../../utils/PullDownRefresh'; | 14 | +import { CustomSelectUI } from '../view/CustomSelectUI'; |
| 15 | +import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; | ||
| 15 | 16 | ||
| 16 | @Entry | 17 | @Entry |
| 17 | @Component | 18 | @Component |
| 18 | struct BrowsingHistoryPage { | 19 | struct BrowsingHistoryPage { |
| 19 | @State private browSingModel: PageModel = new PageModel() | 20 | @State private browSingModel: PageModel = new PageModel() |
| 20 | - | 21 | + isloading : boolean = false |
| 22 | + @Provide isEditState:boolean = false | ||
| 23 | + @State allDatas :CompDTO[] = []; | ||
| 24 | + @State selectDatas :CompDTO[] = []; | ||
| 25 | + @Provide deleteNum :number = 0; | ||
| 26 | + @Provide isAllSelect:boolean = false | ||
| 21 | aboutToAppear(){ | 27 | aboutToAppear(){ |
| 22 | this.getData() | 28 | this.getData() |
| 23 | } | 29 | } |
| 24 | 30 | ||
| 25 | build() { | 31 | build() { |
| 26 | Column(){ | 32 | Column(){ |
| 27 | - CustomTitleUI({titleName:'浏览历史'}) | 33 | + CustomTitleAndEditUI({titleName:'浏览历史',isDisplayButton:true,editCallback:()=>{ |
| 34 | + this.allSelectDatas(false) | ||
| 35 | + this.isAllSelect = false | ||
| 36 | + this.selectDatas = [] | ||
| 37 | + this.deleteNum = 0 | ||
| 38 | + }}) | ||
| 28 | if (this.browSingModel.viewType == ViewType.LOADING){ | 39 | if (this.browSingModel.viewType == ViewType.LOADING){ |
| 29 | this.LoadingLayout() | 40 | this.LoadingLayout() |
| 30 | }else if(this.browSingModel.viewType == ViewType.ERROR){ | 41 | }else if(this.browSingModel.viewType == ViewType.ERROR){ |
| @@ -34,16 +45,21 @@ struct BrowsingHistoryPage { | @@ -34,16 +45,21 @@ struct BrowsingHistoryPage { | ||
| 34 | }else { | 45 | }else { |
| 35 | this.ListLayout() | 46 | this.ListLayout() |
| 36 | } | 47 | } |
| 48 | + | ||
| 49 | + if (this.isEditState){ | ||
| 50 | + CustomBottomFuctionUI({ | ||
| 51 | + selectAllCallback:(isAllSelect)=>{ | ||
| 52 | + this.allSelectDatas(isAllSelect) | ||
| 53 | + }, | ||
| 54 | + confirmCallback:()=>{ | ||
| 55 | + this.deleteDatas() | ||
| 56 | + } | ||
| 57 | + }) | ||
| 58 | + .position({y:'92%'}) | ||
| 59 | + } | ||
| 37 | } | 60 | } |
| 38 | .width(CommonConstants.FULL_WIDTH) | 61 | .width(CommonConstants.FULL_WIDTH) |
| 39 | .height(CommonConstants.FULL_HEIGHT) | 62 | .height(CommonConstants.FULL_HEIGHT) |
| 40 | - .onTouch((event: TouchEvent | undefined) => { | ||
| 41 | - if (event) { | ||
| 42 | - if (this.browSingModel.viewType === ViewType.LOADED) { | ||
| 43 | - listTouchEvent(this.browSingModel, event); | ||
| 44 | - } | ||
| 45 | - } | ||
| 46 | - }) | ||
| 47 | } | 63 | } |
| 48 | 64 | ||
| 49 | @Builder ListLayout() { | 65 | @Builder ListLayout() { |
| @@ -56,11 +72,9 @@ struct BrowsingHistoryPage { | @@ -56,11 +72,9 @@ struct BrowsingHistoryPage { | ||
| 56 | }) | 72 | }) |
| 57 | } | 73 | } |
| 58 | 74 | ||
| 59 | - LazyForEach(this.browSingModel.compList, (compDTO: CompDTO, compIndex: number) => { | 75 | + ForEach(this.allDatas, (compDTO: CompDTO, compIndex: number) => { |
| 60 | ListItem() { | 76 | ListItem() { |
| 61 | - Column() { | ||
| 62 | - CompParser({ compDTO: compDTO, compIndex: compIndex }); | ||
| 63 | - } | 77 | + this.newCompParser(compDTO,compIndex) |
| 64 | } | 78 | } |
| 65 | }) | 79 | }) |
| 66 | 80 | ||
| @@ -79,6 +93,24 @@ struct BrowsingHistoryPage { | @@ -79,6 +93,24 @@ struct BrowsingHistoryPage { | ||
| 79 | .height(CommonConstants.FULL_PARENT) | 93 | .height(CommonConstants.FULL_PARENT) |
| 80 | } | 94 | } |
| 81 | 95 | ||
| 96 | + @Builder | ||
| 97 | + newCompParser(compDTO: CompDTO, compIndex: number){ | ||
| 98 | + Row(){ | ||
| 99 | + if (this.isEditState){ | ||
| 100 | + CustomSelectUI({ | ||
| 101 | + isOn:compDTO.isSelect, | ||
| 102 | + selectCallback:(isOn)=>{ | ||
| 103 | + this.addCompDTO(isOn,compDTO) | ||
| 104 | + } | ||
| 105 | + }) | ||
| 106 | + .margin({left:16}) | ||
| 107 | + } | ||
| 108 | + Column() { | ||
| 109 | + CompParser({ compDTO: compDTO, compIndex: compIndex }) | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | + | ||
| 82 | @Builder LoadingLayout() { | 114 | @Builder LoadingLayout() { |
| 83 | CustomRefreshLoadLayout({ refreshBean: new RefreshLayoutBean(true, | 115 | CustomRefreshLoadLayout({ refreshBean: new RefreshLayoutBean(true, |
| 84 | $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.browSingModel.pullDownRefreshHeight) }) | 116 | $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.browSingModel.pullDownRefreshHeight) }) |
| @@ -89,7 +121,7 @@ struct BrowsingHistoryPage { | @@ -89,7 +121,7 @@ struct BrowsingHistoryPage { | ||
| 89 | MyCollectionViewModel.newFetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(pageDto => { | 121 | MyCollectionViewModel.newFetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(pageDto => { |
| 90 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { | 122 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { |
| 91 | this.browSingModel.viewType = ViewType.LOADED; | 123 | this.browSingModel.viewType = ViewType.LOADED; |
| 92 | - this.browSingModel.compList.push(...pageDto.compList) | 124 | + this.allDatas.push(...pageDto.compList) |
| 93 | if (pageDto.compList.length === this.browSingModel.pageSize) { | 125 | if (pageDto.compList.length === this.browSingModel.pageSize) { |
| 94 | this.browSingModel.currentPage++; | 126 | this.browSingModel.currentPage++; |
| 95 | this.browSingModel.hasMore = true; | 127 | this.browSingModel.hasMore = true; |
| @@ -101,4 +133,49 @@ struct BrowsingHistoryPage { | @@ -101,4 +133,49 @@ struct BrowsingHistoryPage { | ||
| 101 | } | 133 | } |
| 102 | }) | 134 | }) |
| 103 | } | 135 | } |
| 104 | -} | ||
| 136 | + | ||
| 137 | + //数据处理 | ||
| 138 | + //单个选择 | ||
| 139 | + addCompDTO(isOn:boolean , compDTO: CompDTO){ | ||
| 140 | + compDTO.isSelect = isOn; | ||
| 141 | + if (isOn === true){ | ||
| 142 | + this.selectDatas.push(compDTO) | ||
| 143 | + }else { | ||
| 144 | + this.selectDatas.splice(this.selectDatas.indexOf(compDTO),1) | ||
| 145 | + } | ||
| 146 | + this.deleteNum = this.selectDatas.length | ||
| 147 | + | ||
| 148 | + this.isAllSelect = this.deleteNum === this.allDatas.length?true:false; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + //全选 | ||
| 152 | + allSelectDatas(isOn:boolean){ | ||
| 153 | + let datas: CompDTO[] = []; | ||
| 154 | + for (let index = 0; index < this.allDatas.length; index++) { | ||
| 155 | + const compDTO = this.allDatas[index]; | ||
| 156 | + compDTO.isSelect = isOn | ||
| 157 | + datas.push(compDTO) | ||
| 158 | + } | ||
| 159 | + this.selectDatas = [] | ||
| 160 | + this.allDatas = [] | ||
| 161 | + if (isOn === true) { | ||
| 162 | + this.selectDatas.push(...datas) | ||
| 163 | + }else { | ||
| 164 | + this.selectDatas.splice(0,this.deleteNum) | ||
| 165 | + } | ||
| 166 | + this.allDatas.push(...datas) | ||
| 167 | + this.deleteNum = this.selectDatas.length | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + //删除 | ||
| 171 | + deleteDatas(){ | ||
| 172 | + for (let index = 0; index < this.selectDatas.length; index++) { | ||
| 173 | + const compDTO = this.allDatas[index]; | ||
| 174 | + this.allDatas.splice(this.selectDatas.indexOf(compDTO),1) | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + //重置删除状态 | ||
| 178 | + this.isEditState = false | ||
| 179 | + this.isAllSelect = false | ||
| 180 | + } | ||
| 181 | +} |
| 1 | 1 | ||
| 2 | import { CustomTitleUI } from '../reusable/CustomTitleUI'; | 2 | import { CustomTitleUI } from '../reusable/CustomTitleUI'; |
| 3 | -import { EditListInfo } from '../../model/EditInfoModel'; | 3 | +import { EditListInfo, editModel } from '../../model/EditInfoModel'; |
| 4 | import EditInfoViewModel from '../../viewmodel/EditInfoViewModel'; | 4 | import EditInfoViewModel from '../../viewmodel/EditInfoViewModel'; |
| 5 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 5 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 6 | import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog' | 6 | import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog' |
| 7 | import { AreaListModel } from '../../model/AreaListModel'; | 7 | import { AreaListModel } from '../../model/AreaListModel'; |
| 8 | -import router from '@ohos.router'; | ||
| 9 | - | ||
| 10 | 8 | ||
| 11 | @Entry | 9 | @Entry |
| 12 | @Component | 10 | @Component |
| @@ -14,9 +12,15 @@ struct EditUserInfoPage { | @@ -14,9 +12,15 @@ struct EditUserInfoPage { | ||
| 14 | @State listData: EditListInfo[] = [] | 12 | @State listData: EditListInfo[] = [] |
| 15 | @State headerImg: string = '' | 13 | @State headerImg: string = '' |
| 16 | @State dataSource: AreaListModel[] = [] | 14 | @State dataSource: AreaListModel[] = [] |
| 15 | + @State currentUserInfo: editModel = new editModel() | ||
| 17 | 16 | ||
| 18 | dialogController: CustomDialogController = new CustomDialogController({ | 17 | dialogController: CustomDialogController = new CustomDialogController({ |
| 19 | - builder: AreaPickerDialog({dataSource:this.dataSource}), | 18 | + builder: AreaPickerDialog({dataSource:this.dataSource, |
| 19 | + confirmCallback:(area:string)=>{ | ||
| 20 | + this.currentUserInfo.userExtend.city = area; | ||
| 21 | + this.updateEditModel() | ||
| 22 | + } | ||
| 23 | + }), | ||
| 20 | alignment: DialogAlignment.Bottom, | 24 | alignment: DialogAlignment.Bottom, |
| 21 | offset:{dx:0,dy:-20} | 25 | offset:{dx:0,dy:-20} |
| 22 | }) | 26 | }) |
| @@ -109,25 +113,33 @@ struct EditUserInfoPage { | @@ -109,25 +113,33 @@ struct EditUserInfoPage { | ||
| 109 | end:new Date(), | 113 | end:new Date(), |
| 110 | selected:new Date, | 114 | selected:new Date, |
| 111 | lunar:false, | 115 | lunar:false, |
| 112 | - // onAccept:(value:DatePickerResult) => { | ||
| 113 | - // | ||
| 114 | - // } | 116 | + onAccept:(value:DatePickerResult) => { |
| 117 | + let mon = value.month as number + 1 | ||
| 118 | + this.currentUserInfo.userExtend.birthday = value.year+'-'+mon.toString()+'-'+value.day; | ||
| 119 | + this.updateEditModel() | ||
| 120 | + } | ||
| 115 | }) | 121 | }) |
| 116 | }else if(i === 5){ | 122 | }else if(i === 5){ |
| 117 | TextPickerDialog.show({ | 123 | TextPickerDialog.show({ |
| 118 | - range:['男','女'], | 124 | + range:['女','男'], |
| 119 | selected:0, | 125 | selected:0, |
| 120 | - // onAccept:(value:TextPickerResult) => { | ||
| 121 | - // | ||
| 122 | - // } | 126 | + onAccept:(value:TextPickerResult) => { |
| 127 | + this.currentUserInfo.userExtend.sex = value.index.toString(); | ||
| 128 | + this.updateEditModel() | ||
| 129 | + } | ||
| 123 | }) | 130 | }) |
| 124 | } | 131 | } |
| 125 | }) | 132 | }) |
| 126 | } | 133 | } |
| 127 | 134 | ||
| 135 | + updateEditModel(){ | ||
| 136 | + this.listData = [] | ||
| 137 | + this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo)) | ||
| 138 | + } | ||
| 128 | getAccountOwnerInfo(){ | 139 | getAccountOwnerInfo(){ |
| 129 | EditInfoViewModel.queryAccountOwnerInfo(1,getContext(this)).then((editModel) => { | 140 | EditInfoViewModel.queryAccountOwnerInfo(1,getContext(this)).then((editModel) => { |
| 130 | this.headerImg = editModel.userExtend.headPhotoUrl | 141 | this.headerImg = editModel.userExtend.headPhotoUrl |
| 142 | + this.currentUserInfo = editModel; | ||
| 131 | this.listData.push(...EditInfoViewModel.getEditListInfo(editModel)) | 143 | this.listData.push(...EditInfoViewModel.getEditListInfo(editModel)) |
| 132 | }); | 144 | }); |
| 133 | } | 145 | } |
| 1 | -import { CustomTitleUI } from '../reusable/CustomTitleUI' | 1 | +import { CustomTitleAndEditUI } from '../reusable/CustomTitleAndEditUI' |
| 2 | import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel'; | 2 | import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel'; |
| 3 | import PageModel from '../../viewmodel/PageModel'; | 3 | import PageModel from '../../viewmodel/PageModel'; |
| 4 | import { CommonConstants, ViewType } from 'wdConstant' | 4 | import { CommonConstants, ViewType } from 'wdConstant' |
| @@ -11,20 +11,31 @@ import LoadMoreLayout from './LoadMoreLayout' | @@ -11,20 +11,31 @@ 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'; | ||
| 15 | +import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; | ||
| 14 | 16 | ||
| 15 | @Entry | 17 | @Entry |
| 16 | @Component | 18 | @Component |
| 17 | struct MyCollectionListPage { | 19 | struct MyCollectionListPage { |
| 18 | @State private browSingModel: PageModel = new PageModel() | 20 | @State private browSingModel: PageModel = new PageModel() |
| 19 | isloading : boolean = false | 21 | isloading : boolean = false |
| 20 | - | 22 | + @Provide isEditState:boolean = false |
| 23 | + @State allDatas :CompDTO[] = []; | ||
| 24 | + @State selectDatas :CompDTO[] = []; | ||
| 25 | + @Provide deleteNum :number = 0; | ||
| 26 | + @Provide isAllSelect:boolean = false | ||
| 21 | aboutToAppear(){ | 27 | aboutToAppear(){ |
| 22 | this.getData() | 28 | this.getData() |
| 23 | } | 29 | } |
| 24 | 30 | ||
| 25 | build() { | 31 | build() { |
| 26 | Column(){ | 32 | Column(){ |
| 27 | - CustomTitleUI({titleName:'我的收藏'}) | 33 | + CustomTitleAndEditUI({titleName:'我的收藏',isDisplayButton:true,editCallback:()=>{ |
| 34 | + this.allSelectDatas(false) | ||
| 35 | + this.isAllSelect = false | ||
| 36 | + this.selectDatas = [] | ||
| 37 | + this.deleteNum = 0 | ||
| 38 | + }}) | ||
| 28 | if (this.browSingModel.viewType == ViewType.LOADING){ | 39 | if (this.browSingModel.viewType == ViewType.LOADING){ |
| 29 | this.LoadingLayout() | 40 | this.LoadingLayout() |
| 30 | }else if(this.browSingModel.viewType == ViewType.ERROR){ | 41 | }else if(this.browSingModel.viewType == ViewType.ERROR){ |
| @@ -34,6 +45,18 @@ struct MyCollectionListPage { | @@ -34,6 +45,18 @@ struct MyCollectionListPage { | ||
| 34 | }else { | 45 | }else { |
| 35 | this.ListLayout() | 46 | this.ListLayout() |
| 36 | } | 47 | } |
| 48 | + | ||
| 49 | + if (this.isEditState){ | ||
| 50 | + CustomBottomFuctionUI({ | ||
| 51 | + selectAllCallback:(isAllSelect)=>{ | ||
| 52 | + this.allSelectDatas(isAllSelect) | ||
| 53 | + }, | ||
| 54 | + confirmCallback:()=>{ | ||
| 55 | + this.deleteDatas() | ||
| 56 | + } | ||
| 57 | + }) | ||
| 58 | + .position({y:'92%'}) | ||
| 59 | + } | ||
| 37 | } | 60 | } |
| 38 | .width(CommonConstants.FULL_WIDTH) | 61 | .width(CommonConstants.FULL_WIDTH) |
| 39 | .height(CommonConstants.FULL_HEIGHT) | 62 | .height(CommonConstants.FULL_HEIGHT) |
| @@ -49,7 +72,7 @@ struct MyCollectionListPage { | @@ -49,7 +72,7 @@ struct MyCollectionListPage { | ||
| 49 | }) | 72 | }) |
| 50 | } | 73 | } |
| 51 | 74 | ||
| 52 | - LazyForEach(this.browSingModel.compList, (compDTO: CompDTO, compIndex: number) => { | 75 | + ForEach(this.allDatas, (compDTO: CompDTO, compIndex: number) => { |
| 53 | ListItem() { | 76 | ListItem() { |
| 54 | this.newCompParser(compDTO,compIndex) | 77 | this.newCompParser(compDTO,compIndex) |
| 55 | } | 78 | } |
| @@ -73,16 +96,17 @@ struct MyCollectionListPage { | @@ -73,16 +96,17 @@ struct MyCollectionListPage { | ||
| 73 | @Builder | 96 | @Builder |
| 74 | newCompParser(compDTO: CompDTO, compIndex: number){ | 97 | newCompParser(compDTO: CompDTO, compIndex: number){ |
| 75 | Row(){ | 98 | Row(){ |
| 76 | - Button() | ||
| 77 | - .type(ButtonType.Normal) | ||
| 78 | - .width('20') | ||
| 79 | - .height('20') | ||
| 80 | - .backgroundColor('#ED2800') | ||
| 81 | - .borderRadius(5) | ||
| 82 | - .margin({left:16}) | ||
| 83 | - | 99 | + if (this.isEditState){ |
| 100 | + CustomSelectUI({ | ||
| 101 | + isOn:compDTO.isSelect, | ||
| 102 | + selectCallback:(isOn)=>{ | ||
| 103 | + this.addCompDTO(isOn,compDTO) | ||
| 104 | + } | ||
| 105 | + }) | ||
| 106 | + .margin({left:16}) | ||
| 107 | + } | ||
| 84 | Column() { | 108 | Column() { |
| 85 | - CompParser({ compDTO: compDTO, compIndex: compIndex }); | 109 | + CompParser({ compDTO: compDTO, compIndex: compIndex }) |
| 86 | } | 110 | } |
| 87 | } | 111 | } |
| 88 | } | 112 | } |
| @@ -97,7 +121,7 @@ struct MyCollectionListPage { | @@ -97,7 +121,7 @@ struct MyCollectionListPage { | ||
| 97 | MyCollectionViewModel.newFetchMyCollectList(1,'1',this.browSingModel.currentPage,getContext(this)).then(pageDto => { | 121 | MyCollectionViewModel.newFetchMyCollectList(1,'1',this.browSingModel.currentPage,getContext(this)).then(pageDto => { |
| 98 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { | 122 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { |
| 99 | this.browSingModel.viewType = ViewType.LOADED; | 123 | this.browSingModel.viewType = ViewType.LOADED; |
| 100 | - this.browSingModel.compList.push(...pageDto.compList) | 124 | + this.allDatas.push(...pageDto.compList) |
| 101 | if (pageDto.compList.length === this.browSingModel.pageSize) { | 125 | if (pageDto.compList.length === this.browSingModel.pageSize) { |
| 102 | this.browSingModel.currentPage++; | 126 | this.browSingModel.currentPage++; |
| 103 | this.browSingModel.hasMore = true; | 127 | this.browSingModel.hasMore = true; |
| @@ -109,4 +133,49 @@ struct MyCollectionListPage { | @@ -109,4 +133,49 @@ struct MyCollectionListPage { | ||
| 109 | } | 133 | } |
| 110 | }) | 134 | }) |
| 111 | } | 135 | } |
| 136 | + | ||
| 137 | + //数据处理 | ||
| 138 | + //单个选择 | ||
| 139 | + addCompDTO(isOn:boolean , compDTO: CompDTO){ | ||
| 140 | + compDTO.isSelect = isOn; | ||
| 141 | + if (isOn === true){ | ||
| 142 | + this.selectDatas.push(compDTO) | ||
| 143 | + }else { | ||
| 144 | + this.selectDatas.splice(this.selectDatas.indexOf(compDTO),1) | ||
| 145 | + } | ||
| 146 | + this.deleteNum = this.selectDatas.length | ||
| 147 | + | ||
| 148 | + this.isAllSelect = this.deleteNum === this.allDatas.length?true:false; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + //全选 | ||
| 152 | + allSelectDatas(isOn:boolean){ | ||
| 153 | + let datas: CompDTO[] = []; | ||
| 154 | + for (let index = 0; index < this.allDatas.length; index++) { | ||
| 155 | + const compDTO = this.allDatas[index]; | ||
| 156 | + compDTO.isSelect = isOn | ||
| 157 | + datas.push(compDTO) | ||
| 158 | + } | ||
| 159 | + this.selectDatas = [] | ||
| 160 | + this.allDatas = [] | ||
| 161 | + if (isOn === true) { | ||
| 162 | + this.selectDatas.push(...datas) | ||
| 163 | + }else { | ||
| 164 | + this.selectDatas.splice(0,this.deleteNum) | ||
| 165 | + } | ||
| 166 | + this.allDatas.push(...datas) | ||
| 167 | + this.deleteNum = this.selectDatas.length | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + //删除 | ||
| 171 | + deleteDatas(){ | ||
| 172 | + for (let index = 0; index < this.selectDatas.length; index++) { | ||
| 173 | + const compDTO = this.allDatas[index]; | ||
| 174 | + this.allDatas.splice(this.selectDatas.indexOf(compDTO),1) | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + //重置删除状态 | ||
| 178 | + this.isEditState = false | ||
| 179 | + this.isAllSelect = false | ||
| 180 | + } | ||
| 112 | } | 181 | } |
sight_harmony/features/wdComponent/src/main/ets/components/reusable/CustomTitleAndEditUI.ets
0 → 100644
| 1 | +import router from '@ohos.router' | ||
| 2 | + | ||
| 3 | +@Component | ||
| 4 | +export struct CustomTitleAndEditUI { | ||
| 5 | + imgBack:boolean = true | ||
| 6 | + titleName:string = "默认标题" | ||
| 7 | + isDisplayButton:boolean = false | ||
| 8 | + @Consume isEditState:boolean | ||
| 9 | + editCallback: () => void = () => { | ||
| 10 | + } | ||
| 11 | + build() { | ||
| 12 | + RelativeContainer() { | ||
| 13 | + //标题栏目 | ||
| 14 | + if(this.imgBack){ | ||
| 15 | + Image($r('app.media.back_icon')) | ||
| 16 | + .width('46lpx') | ||
| 17 | + .height('46lpx') | ||
| 18 | + .objectFit(ImageFit.Auto) | ||
| 19 | + .interpolation(ImageInterpolation.High) | ||
| 20 | + .id("back_icon") | ||
| 21 | + .alignRules({ | ||
| 22 | + center: {anchor: "__container__", align: VerticalAlign.Center}, | ||
| 23 | + left: {anchor: "__container__", align: HorizontalAlign.Start} | ||
| 24 | + }) | ||
| 25 | + .margin({left:'31lpx'}) | ||
| 26 | + .onClick(()=>{ | ||
| 27 | + router.back() | ||
| 28 | + }) | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + Text(this.titleName) | ||
| 32 | + .height('42lpx') | ||
| 33 | + .maxLines(1) | ||
| 34 | + .id("title") | ||
| 35 | + .fontSize('35lpx') | ||
| 36 | + .fontWeight(400) | ||
| 37 | + .fontColor($r('app.color.color_222222')) | ||
| 38 | + .lineHeight('42lpx') | ||
| 39 | + .alignRules({ | ||
| 40 | + center: {anchor: "__container__", align: VerticalAlign.Center}, | ||
| 41 | + middle: {anchor: "__container__", align: HorizontalAlign.Center} | ||
| 42 | + }) | ||
| 43 | + | ||
| 44 | + if (this.isDisplayButton){ | ||
| 45 | + Button(this.isEditState === true?'取消':'编辑') | ||
| 46 | + .type(ButtonType.Normal) | ||
| 47 | + .fontColor($r('app.color.color_222222')) | ||
| 48 | + .backgroundColor(Color.White) | ||
| 49 | + .id("edit_Button") | ||
| 50 | + .alignRules({ | ||
| 51 | + center: {anchor: "__container__", align: VerticalAlign.Center}, | ||
| 52 | + right: {anchor: "__container__", align: HorizontalAlign.End} | ||
| 53 | + }) | ||
| 54 | + .margin({right:'31lpx'}) | ||
| 55 | + .onClick(()=>{ | ||
| 56 | + this.isEditState = !this.isEditState | ||
| 57 | + this.editCallback() | ||
| 58 | + }) | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + .height('84lpx') | ||
| 62 | + .width('100%') | ||
| 63 | + .backgroundColor($r('app.color.white')) | ||
| 64 | + | ||
| 65 | + } | ||
| 66 | +} |
| @@ -37,10 +37,10 @@ export struct CustomTitleUI { | @@ -37,10 +37,10 @@ export struct CustomTitleUI { | ||
| 37 | center: {anchor: "__container__", align: VerticalAlign.Center}, | 37 | center: {anchor: "__container__", align: VerticalAlign.Center}, |
| 38 | middle: {anchor: "__container__", align: HorizontalAlign.Center} | 38 | middle: {anchor: "__container__", align: HorizontalAlign.Center} |
| 39 | }) | 39 | }) |
| 40 | + | ||
| 40 | } | 41 | } |
| 41 | .height('84lpx') | 42 | .height('84lpx') |
| 42 | .width('100%') | 43 | .width('100%') |
| 43 | .backgroundColor($r('app.color.white')) | 44 | .backgroundColor($r('app.color.white')) |
| 44 | - | ||
| 45 | } | 45 | } |
| 46 | } | 46 | } |
| @@ -24,6 +24,7 @@ export struct CompStyle_09 { | @@ -24,6 +24,7 @@ export struct CompStyle_09 { | ||
| 24 | // 大图 | 24 | // 大图 |
| 25 | Image(this.compDTO.operDataList[0].coverUrl) | 25 | Image(this.compDTO.operDataList[0].coverUrl) |
| 26 | .width('100%') | 26 | .width('100%') |
| 27 | + .borderRadius({topLeft: $r('app.float.image_border_radius'), topRight: $r('app.float.image_border_radius')}) | ||
| 27 | // 时间线--后端返回三个, | 28 | // 时间线--后端返回三个, |
| 28 | Column(){ | 29 | Column(){ |
| 29 | ForEach(this.compDTO.operDataList[0].slideShows, (item:slideShows, index:number) => { | 30 | ForEach(this.compDTO.operDataList[0].slideShows, (item:slideShows, index:number) => { |
| @@ -44,7 +45,7 @@ export struct CompStyle_09 { | @@ -44,7 +45,7 @@ export struct CompStyle_09 { | ||
| 44 | .backgroundColor($r('app.color.color_F5F5F5')) | 45 | .backgroundColor($r('app.color.color_F5F5F5')) |
| 45 | .width(CommonConstants.FULL_WIDTH) | 46 | .width(CommonConstants.FULL_WIDTH) |
| 46 | .height(40) | 47 | .height(40) |
| 47 | - .borderRadius(3) | 48 | + .borderRadius($r('app.float.button_border_radius')) |
| 48 | .justifyContent(FlexAlign.Center) | 49 | .justifyContent(FlexAlign.Center) |
| 49 | .margin({top: 5}) | 50 | .margin({top: 5}) |
| 50 | } | 51 | } |
| @@ -103,7 +104,7 @@ export struct CompStyle_09 { | @@ -103,7 +104,7 @@ export struct CompStyle_09 { | ||
| 103 | Image(item.fullColumnImgUrls[0].url) | 104 | Image(item.fullColumnImgUrls[0].url) |
| 104 | .width(90) | 105 | .width(90) |
| 105 | .height(60) | 106 | .height(60) |
| 106 | - .borderRadius(4) | 107 | + .borderRadius($r('app.float.image_border_radius')) |
| 107 | } | 108 | } |
| 108 | } | 109 | } |
| 109 | } | 110 | } |
| @@ -26,6 +26,7 @@ export struct CompStyle_10 { | @@ -26,6 +26,7 @@ export struct CompStyle_10 { | ||
| 26 | // 大图 | 26 | // 大图 |
| 27 | Image(this.compDTO.operDataList[0] && this.compDTO.operDataList[0].coverUrl) | 27 | Image(this.compDTO.operDataList[0] && this.compDTO.operDataList[0].coverUrl) |
| 28 | .width('100%') | 28 | .width('100%') |
| 29 | + .borderRadius({topLeft: $r('app.float.image_border_radius'), topRight: $r('app.float.image_border_radius')}) | ||
| 29 | .onClick((event: ClickEvent) => { | 30 | .onClick((event: ClickEvent) => { |
| 30 | ProcessUtils.processPage(this.compDTO?.operDataList[0]) | 31 | ProcessUtils.processPage(this.compDTO?.operDataList[0]) |
| 31 | }) | 32 | }) |
| @@ -49,7 +50,7 @@ export struct CompStyle_10 { | @@ -49,7 +50,7 @@ export struct CompStyle_10 { | ||
| 49 | .backgroundColor($r('app.color.color_F5F5F5')) | 50 | .backgroundColor($r('app.color.color_F5F5F5')) |
| 50 | .width(CommonConstants.FULL_WIDTH) | 51 | .width(CommonConstants.FULL_WIDTH) |
| 51 | .height(40) | 52 | .height(40) |
| 52 | - .borderRadius(3) | 53 | + .borderRadius($r('app.float.button_border_radius')) |
| 53 | .justifyContent(FlexAlign.Center) | 54 | .justifyContent(FlexAlign.Center) |
| 54 | .margin({top: 5}) | 55 | .margin({top: 5}) |
| 55 | .onClick((event: ClickEvent) => { | 56 | .onClick((event: ClickEvent) => { |
| @@ -105,7 +106,7 @@ export struct CompStyle_10 { | @@ -105,7 +106,7 @@ export struct CompStyle_10 { | ||
| 105 | .width(117) | 106 | .width(117) |
| 106 | .height(78) | 107 | .height(78) |
| 107 | .objectFit(ImageFit.Cover) | 108 | .objectFit(ImageFit.Cover) |
| 108 | - .borderRadius(4) | 109 | + .borderRadius($r('app.float.image_border_radius')) |
| 109 | .margin({left: 12}) | 110 | .margin({left: 12}) |
| 110 | } | 111 | } |
| 111 | } | 112 | } |
sight_harmony/features/wdComponent/src/main/ets/components/view/CustomBottomFuctionUI.ets
0 → 100644
| 1 | + | ||
| 2 | +@Component | ||
| 3 | +export struct CustomBottomFuctionUI { | ||
| 4 | + @Consume deleteNum: number | ||
| 5 | + @Consume isAllSelect: boolean | ||
| 6 | + selectAllCallback: (isOn: boolean) => void = () => { | ||
| 7 | + } | ||
| 8 | + confirmCallback: () => void = () => { | ||
| 9 | + } | ||
| 10 | + build() { | ||
| 11 | + RelativeContainer(){ | ||
| 12 | + Row(){ | ||
| 13 | + Image(this.isAllSelect?$r("app.media.MyCollection_selected_icon"):$r("app.media.MyCollection_unselected_icon")) | ||
| 14 | + .width('20') | ||
| 15 | + .height('20') | ||
| 16 | + .margin({right:'31lpx' }) | ||
| 17 | + | ||
| 18 | + Text(this.isAllSelect?'取消':'全选') | ||
| 19 | + .fontColor($r('app.color.color_222222')) | ||
| 20 | + .backgroundColor(Color.White) | ||
| 21 | + } | ||
| 22 | + .id("allSelect_Button") | ||
| 23 | + .margin({left:'31lpx'}) | ||
| 24 | + .alignRules({ | ||
| 25 | + center: {anchor: "__container__", align: VerticalAlign.Center}, | ||
| 26 | + left: {anchor: "__container__", align: HorizontalAlign.Start} | ||
| 27 | + }) | ||
| 28 | + .onClick(()=>{ | ||
| 29 | + this.isAllSelect = !this.isAllSelect; | ||
| 30 | + this.selectAllCallback(this.isAllSelect) | ||
| 31 | + }) | ||
| 32 | + | ||
| 33 | + | ||
| 34 | + Button('删除'+ (this.deleteNum === 0 ? '':'('+this.deleteNum.toString()+')')) | ||
| 35 | + .type(ButtonType.Normal) | ||
| 36 | + .fontColor(this.deleteNum === 0?$r('app.color.color_222222'):$r('app.color.color_ED2800')) | ||
| 37 | + .backgroundColor(Color.White) | ||
| 38 | + .id("delete_Button") | ||
| 39 | + .alignRules({ | ||
| 40 | + center: {anchor: "__container__", align: VerticalAlign.Center}, | ||
| 41 | + right: {anchor: "__container__", align: HorizontalAlign.End} | ||
| 42 | + }) | ||
| 43 | + .margin({right:'31lpx'}) | ||
| 44 | + .onClick(()=>{ | ||
| 45 | + this.confirmCallback() | ||
| 46 | + }) | ||
| 47 | + } | ||
| 48 | + .height('8%') | ||
| 49 | + .width('100%') | ||
| 50 | + .backgroundColor(Color.White) | ||
| 51 | + } | ||
| 52 | +} |
| 1 | + | ||
| 2 | +@Component | ||
| 3 | +export struct CustomSelectUI { | ||
| 4 | + @State isOn: boolean = false | ||
| 5 | + selectCallback: (isOn: boolean) => void = () => { | ||
| 6 | + } | ||
| 7 | + build() { | ||
| 8 | + Button(){ | ||
| 9 | + Image(this.isOn?$r("app.media.MyCollection_selected_icon"):$r("app.media.MyCollection_unselected_icon")) | ||
| 10 | + } | ||
| 11 | + .backgroundColor(Color.White) | ||
| 12 | + .type(ButtonType.Normal) | ||
| 13 | + .width('20') | ||
| 14 | + .height('20') | ||
| 15 | + .onClick(() => { | ||
| 16 | + this.isOn = !this.isOn; | ||
| 17 | + this.selectCallback(this.isOn) | ||
| 18 | + }) | ||
| 19 | + } | ||
| 20 | +} |
| @@ -47,7 +47,7 @@ export struct ZhGridLayoutComponent { | @@ -47,7 +47,7 @@ export struct ZhGridLayoutComponent { | ||
| 47 | buildItemCard(item: ContentDTO) { | 47 | buildItemCard(item: ContentDTO) { |
| 48 | Column() { | 48 | Column() { |
| 49 | Image(item.coverUrl) | 49 | Image(item.coverUrl) |
| 50 | - .borderRadius(5) | 50 | + .width(44) |
| 51 | .aspectRatio(1 / 1) | 51 | .aspectRatio(1 / 1) |
| 52 | .margin(16) | 52 | .margin(16) |
| 53 | Text(item.newsTitle) | 53 | Text(item.newsTitle) |
| @@ -13,6 +13,8 @@ export struct AreaPickerDialog { | @@ -13,6 +13,8 @@ export struct AreaPickerDialog { | ||
| 13 | title: string = '地区选择' | 13 | title: string = '地区选择' |
| 14 | @Provide dataSource: AreaListModel[] = [] | 14 | @Provide dataSource: AreaListModel[] = [] |
| 15 | result: JSON[] = []; | 15 | result: JSON[] = []; |
| 16 | + confirmCallback: (area:string) => void = () => { | ||
| 17 | + } | ||
| 16 | 18 | ||
| 17 | build() { | 19 | build() { |
| 18 | Column(){ | 20 | Column(){ |
| @@ -35,7 +37,7 @@ export struct AreaPickerDialog { | @@ -35,7 +37,7 @@ export struct AreaPickerDialog { | ||
| 35 | Button('确定',{type:ButtonType.Normal}) | 37 | Button('确定',{type:ButtonType.Normal}) |
| 36 | .onClick(()=> { | 38 | .onClick(()=> { |
| 37 | this.controller.close() | 39 | this.controller.close() |
| 38 | - Logger.info('area',this.currentFirst.label+this.currentSecondBean.label+this.currentThirdBean.label); | 40 | + this.confirmCallback(this.currentFirst.label+this.currentSecondBean.label+this.currentThirdBean.label); |
| 39 | }) | 41 | }) |
| 40 | .backgroundColor(0xffffff) | 42 | .backgroundColor(0xffffff) |
| 41 | .fontColor(Color.Blue) | 43 | .fontColor(Color.Blue) |
| @@ -11,32 +11,37 @@ export class EditListInfo{ | @@ -11,32 +11,37 @@ export class EditListInfo{ | ||
| 11 | } | 11 | } |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | -export interface EditInfoModel{ | 14 | +export class EditInfoModel{ |
| 15 | //头像 | 15 | //头像 |
| 16 | - headPhotoUrl:string | 16 | + headPhotoUrl:string = '' |
| 17 | //简介 | 17 | //简介 |
| 18 | - introduction:string | 18 | + introduction:string = '' |
| 19 | //城市 | 19 | //城市 |
| 20 | - city:string | 20 | + city:string = '' |
| 21 | //地区 | 21 | //地区 |
| 22 | - county:string | 22 | + county:string = '' |
| 23 | //生日 | 23 | //生日 |
| 24 | - birthday:string | 24 | + birthday:string = '' |
| 25 | //性别 | 25 | //性别 |
| 26 | - sex:number | 26 | + sex:string = '' |
| 27 | 27 | ||
| 28 | - airec:number | 28 | + airec:number = 0 |
| 29 | 29 | ||
| 30 | + constructor(headPhotoUrl?:string , introduction?:string,city?:string , county?:string,birthday?:string , sex?:string,airec?:number) { | ||
| 31 | + } | ||
| 30 | } | 32 | } |
| 31 | 33 | ||
| 32 | -export interface editModel{ | ||
| 33 | - userName:string | 34 | +export class editModel{ |
| 35 | + userName:string = '' | ||
| 36 | + | ||
| 37 | + userNameStatus:string = '' | ||
| 34 | 38 | ||
| 35 | - userNameStatus:string | 39 | + phone:string = '' |
| 36 | 40 | ||
| 37 | - phone:string | 41 | + headPhotoStatus:string = '' |
| 38 | 42 | ||
| 39 | - headPhotoStatus:string | 43 | + userExtend:EditInfoModel = new EditInfoModel() |
| 40 | 44 | ||
| 41 | - userExtend:EditInfoModel | 45 | + constructor(userName?:string , userNameStatus?:string,phone?:string , headPhotoStatus?:string,userExtend?:EditInfoModel) { |
| 46 | + } | ||
| 42 | } | 47 | } |
| @@ -30,11 +30,11 @@ class EditInfoViewModel { | @@ -30,11 +30,11 @@ class EditInfoViewModel { | ||
| 30 | 30 | ||
| 31 | getEditListInfo(item?:editModel):EditListInfo[]{ | 31 | getEditListInfo(item?:editModel):EditListInfo[]{ |
| 32 | this.editListData = [ | 32 | this.editListData = [ |
| 33 | - new EditListInfo('昵称',item&&item.userName?item.userName:'待完善'), | ||
| 34 | - new EditListInfo('简介',item&&item.userExtend.introduction?item.userExtend.introduction:'待完善'), | ||
| 35 | - new EditListInfo('地区',item&&item.userExtend.city?item.userExtend.city:'待完善'), | ||
| 36 | - new EditListInfo('生日',item&&item.userExtend.birthday?item.userExtend.birthday:'待完善'), | ||
| 37 | - new EditListInfo('性别',item&&item.userExtend.sex?item.userExtend.sex===1?'男':'女':'待完善'), | 33 | + new EditListInfo('昵称',item&&item.userName.length > 0?item.userName:'待完善'), |
| 34 | + new EditListInfo('简介',item&&item.userExtend.introduction.length > 0?item.userExtend.introduction:'待完善'), | ||
| 35 | + new EditListInfo('地区',item&&item.userExtend.city.length > 0?item.userExtend.city:'待完善'), | ||
| 36 | + new EditListInfo('生日',item&&item.userExtend.birthday.length > 0?item.userExtend.birthday:'待完善'), | ||
| 37 | + new EditListInfo('性别',item&&item.userExtend.sex.length > 0?(item.userExtend.sex=== '1'?'男':'女'):'待完善'), | ||
| 38 | ] | 38 | ] |
| 39 | return this.editListData | 39 | return this.editListData |
| 40 | } | 40 | } |
| @@ -61,7 +61,7 @@ class EditInfoViewModel { | @@ -61,7 +61,7 @@ class EditInfoViewModel { | ||
| 61 | let compRes: ResponseDTO<editModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<editModel>>(context,'userInfo.json'); | 61 | let compRes: ResponseDTO<editModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<editModel>>(context,'userInfo.json'); |
| 62 | if (!compRes || !compRes.data) { | 62 | if (!compRes || !compRes.data) { |
| 63 | Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`); | 63 | Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`); |
| 64 | - return {} as editModel | 64 | + return new editModel() |
| 65 | } | 65 | } |
| 66 | Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | 66 | Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); |
| 67 | return compRes.data | 67 | return compRes.data |
| @@ -82,7 +82,11 @@ | @@ -82,7 +82,11 @@ | ||
| 82 | }, | 82 | }, |
| 83 | { | 83 | { |
| 84 | "name": "image_border_radius", | 84 | "name": "image_border_radius", |
| 85 | - "value": "8vp" | 85 | + "value": "5vp" |
| 86 | + }, | ||
| 87 | + { | ||
| 88 | + "name": "button_border_radius", | ||
| 89 | + "value": "3vp" | ||
| 86 | }, | 90 | }, |
| 87 | { | 91 | { |
| 88 | "name": "border_radius_6", | 92 | "name": "border_radius_6", |
-
Please register or login to post a comment