wangliang_wd

feat:优化编辑资料

@@ -2,7 +2,7 @@ import { CustomTitleAndEditUI } from '../reusable/CustomTitleAndEditUI' @@ -2,7 +2,7 @@ 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'
5 -import { EmptyComponent } from '../view/EmptyComponent' 5 +import { EmptyComponent,WDViewDefaultType } 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';
@@ -41,31 +41,28 @@ struct BrowsingHistoryPage { @@ -41,31 +41,28 @@ struct BrowsingHistoryPage {
41 this.deleteNum = 0 41 this.deleteNum = 0
42 }}) 42 }})
43 43
44 - CustomPullToRefresh({  
45 - alldata:this.allDatas,  
46 - scroller:this.scroller,  
47 - customList:()=>{  
48 - this.ListLayout()  
49 - },  
50 - onRefresh:(resolve)=>{  
51 - this.browSingModel.currentPage = 0  
52 - this.getData(resolve)  
53 - },  
54 - onLoadMore:(resolve)=> {  
55 - this.browSingModel.currentPage++  
56 - this.getData()  
57 - }  
58 - })  
59 -  
60 -  
61 // if (this.browSingModel.viewType == ViewType.LOADING){ 44 // if (this.browSingModel.viewType == ViewType.LOADING){
62 // this.LoadingLayout() 45 // this.LoadingLayout()
63 // }else if(this.browSingModel.viewType == ViewType.ERROR){ 46 // }else if(this.browSingModel.viewType == ViewType.ERROR){
64 // ErrorComponent() 47 // ErrorComponent()
65 // }else if(this.browSingModel.viewType == ViewType.EMPTY){ 48 // }else if(this.browSingModel.viewType == ViewType.EMPTY){
66 - // EmptyComponent() 49 + EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoHistory})
67 // }else { 50 // }else {
68 - // this.ListLayout() 51 + // CustomPullToRefresh({
  52 + // alldata:this.allDatas,
  53 + // scroller:this.scroller,
  54 + // customList:()=>{
  55 + // this.ListLayout()
  56 + // },
  57 + // onRefresh:(resolve)=>{
  58 + // this.browSingModel.currentPage = 0
  59 + // this.getData(resolve)
  60 + // },
  61 + // onLoadMore:(resolve)=> {
  62 + // this.browSingModel.currentPage++
  63 + // this.getData()
  64 + // }
  65 + // })
69 // } 66 // }
70 67
71 if (this.isEditState){ 68 if (this.isEditState){
@@ -127,7 +127,8 @@ struct EditUserInfoPage { @@ -127,7 +127,8 @@ struct EditUserInfoPage {
127 lunar:false, 127 lunar:false,
128 onAccept:(value:DatePickerResult) => { 128 onAccept:(value:DatePickerResult) => {
129 let mon = value.month as number + 1 129 let mon = value.month as number + 1
130 - this.currentUserInfo.userExtend.birthday = value.year+'-'+mon.toString()+'-'+value.day; 130 + let monStr = mon < 10? '0'+mon.toString():mon.toString();
  131 + this.currentUserInfo.userExtend.birthday = value.year+'-'+monStr+'-'+value.day;
131 this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_birthday 132 this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_birthday
132 this.updateEditModel() 133 this.updateEditModel()
133 } 134 }
@@ -171,8 +172,10 @@ struct EditUserInfoPage { @@ -171,8 +172,10 @@ struct EditUserInfoPage {
171 172
172 updateEditModel(){ 173 updateEditModel(){
173 this.listData = [] 174 this.listData = []
174 - this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo))  
175 - EditInfoViewModel.updateUserInfo(this.currentUserInfo) 175 + // this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo))
  176 + EditInfoViewModel.updateUserInfo(this.currentUserInfo).then(()=>{
  177 + this.getAccountOwnerInfo()
  178 + })
176 } 179 }
177 getAccountOwnerInfo(){ 180 getAccountOwnerInfo(){
178 EditInfoViewModel.queryAccountOwnerInfo(1,getContext(this)).then((editModel) => { 181 EditInfoViewModel.queryAccountOwnerInfo(1,getContext(this)).then((editModel) => {
@@ -108,7 +108,9 @@ export struct EmptyComponent { @@ -108,7 +108,9 @@ export struct EmptyComponent {
108 let contentString: string = '暂无内容' 108 let contentString: string = '暂无内容'
109 if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) { 109 if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) {
110 contentString = '暂无收藏' 110 contentString = '暂无收藏'
111 - } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) { 111 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoHistory) {
  112 + contentString = '暂无浏览历史'
  113 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) {
112 contentString = '暂无消息' 114 contentString = '暂无消息'
113 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment) { 115 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment) {
114 contentString = '暂无评论' 116 contentString = '暂无评论'
@@ -140,7 +142,7 @@ export struct EmptyComponent { @@ -140,7 +142,7 @@ export struct EmptyComponent {
140 buildNoDataTipImage(): Resource | string { 142 buildNoDataTipImage(): Resource | string {
141 Logger.info(TAG, "buildNoDataTip"); 143 Logger.info(TAG, "buildNoDataTip");
142 let imageString: Resource | string = $r('app.media.icon_no_content') 144 let imageString: Resource | string = $r('app.media.icon_no_content')
143 - if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) { 145 + if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection||this.emptyType === WDViewDefaultType.WDViewDefaultType_NoHistory) {
144 imageString = $r('app.media.icon_no_collection') 146 imageString = $r('app.media.icon_no_collection')
145 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) { 147 } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) {
146 imageString = $r('app.media.icon_no_message') 148 imageString = $r('app.media.icon_no_message')
@@ -33,6 +33,7 @@ export struct SecondLevelComponent { @@ -33,6 +33,7 @@ export struct SecondLevelComponent {
33 } 33 }
34 34
35 onFirstChange(){ 35 onFirstChange(){
  36 + this.select = 0
36 if (!this.currentFirst) { 37 if (!this.currentFirst) {
37 this.mTip = '暂无数据'; 38 this.mTip = '暂无数据';
38 } else { 39 } else {
@@ -34,10 +34,11 @@ export struct ThirdLevelComponent { @@ -34,10 +34,11 @@ export struct ThirdLevelComponent {
34 } 34 }
35 35
36 onFirstChange(){ 36 onFirstChange(){
37 - 37 + this.select = 0
38 } 38 }
39 39
40 onSecondChange(){ 40 onSecondChange(){
  41 + this.select = 0
41 if (!this.currentSecondBean) { 42 if (!this.currentSecondBean) {
42 this.mTip = '暂无数据'; 43 this.mTip = '暂无数据';
43 } else { 44 } else {
@@ -40,7 +40,7 @@ export class EditInfoModel{ @@ -40,7 +40,7 @@ export class EditInfoModel{
40 //生日 40 //生日
41 birthday:string = '' 41 birthday:string = ''
42 //性别 42 //性别
43 - sex:number = 0 43 + sex:number = 10
44 44
45 airec:number = 0 45 airec:number = 0
46 46
@@ -44,7 +44,7 @@ class EditInfoViewModel { @@ -44,7 +44,7 @@ class EditInfoViewModel {
44 new EditListInfo('简介',item&&item.userExtend.introduction?item.userExtend.introduction:'待完善'), 44 new EditListInfo('简介',item&&item.userExtend.introduction?item.userExtend.introduction:'待完善'),
45 new EditListInfo('地区',item&&item.userExtend.address?item.userExtend.address:'待完善'), 45 new EditListInfo('地区',item&&item.userExtend.address?item.userExtend.address:'待完善'),
46 new EditListInfo('生日',item&&item.userExtend.birthday?item.userExtend.birthday:'待完善'), 46 new EditListInfo('生日',item&&item.userExtend.birthday?item.userExtend.birthday:'待完善'),
47 - new EditListInfo('性别',item?(item.userExtend.sex === 1?'男':'女'):'待完善'),] 47 + new EditListInfo('性别',item?(item.userExtend.sex === 10?'待完善':(item.userExtend.sex === 1?'男':'女')):'待完善'),]
48 return this.editListData 48 return this.editListData
49 } 49 }
50 50
@@ -129,6 +129,7 @@ class EditInfoViewModel { @@ -129,6 +129,7 @@ class EditInfoViewModel {
129 .then((navResDTO: ResponseDTO) => { 129 .then((navResDTO: ResponseDTO) => {
130 if (navResDTO.code == 0) { 130 if (navResDTO.code == 0) {
131 promptAction.showToast({ message: '修改成功' }) 131 promptAction.showToast({ message: '修改成功' })
  132 + success(navResDTO)
132 }else { 133 }else {
133 promptAction.showToast({ message: navResDTO.message }) 134 promptAction.showToast({ message: navResDTO.message })
134 } 135 }