wangliang_wd

feat:优化地区选择逻辑

... ... @@ -5,6 +5,7 @@ import EditInfoViewModel from '../../viewmodel/EditInfoViewModel';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog'
import { AreaListModel } from '../../model/AreaListModel';
import router from '@ohos.router';
@Entry
... ... @@ -25,6 +26,10 @@ struct EditUserInfoPage {
this.getAreaList()
}
onPageShow(){
}
build() {
Row() {
Column() {
... ... @@ -89,7 +94,6 @@ struct EditUserInfoPage {
.width('100%')
.onClick(()=>{
if (i === 1){
// WDRouterRule.jumpWithPage(WDRouterPage.editUserInfoPage)
WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage)
}else if (i === 2){
WDRouterRule.jumpWithPage(WDRouterPage.editUserIntroductionPage)
... ...
import { CustomTitleUI } from '../reusable/CustomTitleUI'
import router from '@ohos.router'
@Entry
@Component
struct EditUserIntroductionPage {
@State numCount: number = 0
@State textColor : string = '#222222'
@State introduction: string = ''
build() {
Column(){
... ... @@ -23,6 +25,7 @@ struct EditUserIntroductionPage {
}else {
this.textColor = '#222222'
}
this.introduction = value
})
Text(this.numCount.toString() + '/60')
... ... @@ -46,6 +49,12 @@ struct EditUserIntroductionPage {
.backgroundColor('#ED2800')
.borderRadius(5)
.margin(30)
.onClick(()=>{
router.back({
url:'',
params:{nikeName:this.introduction}
})
})
}
}
}
\ No newline at end of file
... ...
import { CustomTitleUI } from '../reusable/CustomTitleUI'
import router from '@ohos.router'
@Entry
@Component
... ... @@ -6,6 +7,7 @@ struct EditUserNikeNamePage {
///接收传参
@State numCount: number = 0
@State textColor : string = '#222222'
@State nikeName: string = ''
build() {
Column(){
... ... @@ -24,6 +26,7 @@ struct EditUserNikeNamePage {
}else {
this.textColor = '#222222'
}
this.nikeName = value
})
Text(this.numCount.toString() + '/16')
... ... @@ -46,6 +49,12 @@ struct EditUserNikeNamePage {
.backgroundColor('#ED2800')
.borderRadius(5)
.margin(30)
.onClick(()=>{
router.back({
url:'',
params:{nikeName:this.nikeName}
})
})
}
}
}
\ No newline at end of file
... ...
... ... @@ -51,9 +51,7 @@ struct MyCollectionListPage {
LazyForEach(this.browSingModel.compList, (compDTO: CompDTO, compIndex: number) => {
ListItem() {
Column() {
CompParser({ compDTO: compDTO, compIndex: compIndex });
}
this.newCompParser(compDTO,compIndex)
}
})
... ... @@ -72,6 +70,23 @@ struct MyCollectionListPage {
.height(CommonConstants.FULL_PARENT)
}
@Builder
newCompParser(compDTO: CompDTO, compIndex: number){
Row(){
Button()
.type(ButtonType.Normal)
.width('20')
.height('20')
.backgroundColor('#ED2800')
.borderRadius(5)
.margin({left:16})
Column() {
CompParser({ compDTO: compDTO, compIndex: compIndex });
}
}
}
@Builder LoadingLayout() {
CustomRefreshLoadLayout({ refreshBean: new RefreshLayoutBean(true,
$r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.browSingModel.pullDownRefreshHeight) })
... ...
import { Logger } from 'wdKit';
import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel';
import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel';
import { FirstLevelComponent } from './FirstLevelComponent';
... ... @@ -13,12 +14,6 @@ export struct AreaPickerDialog {
@Provide dataSource: AreaListModel[] = []
result: JSON[] = [];
aboutToAppear(){
this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[0])
this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.dataSource[0].children[0])
this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.dataSource[0].children[0].children[0])
}
build() {
Column(){
Row(){
... ... @@ -39,7 +34,8 @@ export struct AreaPickerDialog {
Button('确定',{type:ButtonType.Normal})
.onClick(()=> {
this.controller.close()
Logger.info('area',this.currentFirst.label+this.currentSecondBean.label+this.currentThirdBean.label);
})
.backgroundColor(0xffffff)
.fontColor(Color.Blue)
... ...
... ... @@ -12,6 +12,7 @@ export struct FirstLevelComponent {
const element = this.dataSource[index];
this.labelList.push(element.label)
}
this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[this.select])
}
build() {
... ... @@ -21,10 +22,10 @@ export struct FirstLevelComponent {
Text('暂无数据').fontSize(20)
}else {
TextPicker({range:this.labelList,selected:this.select})
// .onChange((value:string,index:number) => {
// this.select = index
// this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[index])
// })
.onChange((value: string | string[], index: number | number[]) => {
this.select = index as number
this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[index as number])
})
.backgroundColor(Color.White)
.border({color:'#e2e2e2',width:{right:0.5}})
.width('100%')
... ...
import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel';
import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel';
@Component
export struct SecondLevelComponent {
@State mTip: string = '暂无数据'
... ... @@ -8,13 +8,6 @@ export struct SecondLevelComponent {
@Consume @Watch('onFirstChange') currentFirst: AreaListManageModel;
@Consume currentSecondBean: AreaListManageModel
aboutToAppear(){
for (let index = 0; index < this.currentFirst.children.length; index++) {
const element = this.currentFirst.children[index];
this.labelList.push(element.label)
}
}
build() {
Column(){
Column(){
... ... @@ -22,10 +15,10 @@ export struct SecondLevelComponent {
Text(this.mTip).fontSize(20)
}else {
TextPicker({range:this.labelList,selected:this.select})
// .onChange((value:string,index:number) => {
// this.select = index
// this.currentSecondBean = this.currentFirst.children[index]
// })
.onChange((value: string | string[], index: number | number[]) => {
this.select = index as number
this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[index as number])
})
.backgroundColor(Color.White)
.border({color:'#e2e2e2',width:{right:0.5}})
.width('100%')
... ... @@ -47,7 +40,7 @@ export struct SecondLevelComponent {
const element = this.currentFirst.children[index];
this.labelList.push(element.label)
}
// this.currentSecondBean = this.currentFirst.children[this.select]
this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[this.select])
}
}
}
\ No newline at end of file
... ...
import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel';
import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel';
@Component
export struct ThirdLevelComponent {
@State mTip: string = '暂无数据'
... ... @@ -9,13 +9,6 @@ export struct ThirdLevelComponent {
@Consume @Watch('onSecondChange') currentSecondBean: AreaListManageModel;
@Consume currentThirdBean: AreaListManageModel
aboutToAppear(){
for (let index = 0; index < this.currentSecondBean.children.length; index++) {
const element = this.currentSecondBean.children[index];
this.labelList.push(element.label)
}
}
build() {
Column(){
Column(){
... ... @@ -23,10 +16,10 @@ export struct ThirdLevelComponent {
Text(this.mTip).fontSize(20)
}else {
TextPicker({range:this.labelList,selected:this.select})
// .onChange((value:string,index:number) => {
// this.select = index
// this.currentThirdBean = this.currentSecondBean.children[index]
// })
.onChange((value: string | string[], index: number | number[]) => {
this.select = index as number
this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[index as number])
})
.backgroundColor(Color.White)
.border({color:'#e2e2e2',width:{right:0.5}})
.width('100%')
... ... @@ -52,7 +45,7 @@ export struct ThirdLevelComponent {
const element = this.currentSecondBean.children[index];
this.labelList.push(element.label)
}
// this.currentThirdBean = this.currentSecondBean.children[this.select]
this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[this.select])
}
}
}
\ No newline at end of file
... ...