王士厅
Showing 18 changed files with 145 additions and 64 deletions
@@ -261,6 +261,14 @@ export class HttpUrlUtils { @@ -261,6 +261,14 @@ export class HttpUrlUtils {
261 return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc'; 261 return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc';
262 } 262 }
263 263
  264 + static getRefreshToken() {
  265 + let refreshToken = SPHelper.default.getSync(SpConstants.USER_REFRESH_TOKEN,"")
  266 + if(StringUtils.isNotEmpty(refreshToken)) {
  267 + return refreshToken as string;
  268 + }
  269 + return '';
  270 + }
  271 +
264 private static getDeviceId() { 272 private static getDeviceId() {
265 // TODO 273 // TODO
266 return '8a81226a-cabd-3e1b-b630-b51db4a720ed'; 274 return '8a81226a-cabd-3e1b-b630-b51db4a720ed';
@@ -350,6 +358,12 @@ export class HttpUrlUtils { @@ -350,6 +358,12 @@ export class HttpUrlUtils {
350 return url; 358 return url;
351 } 359 }
352 360
  361 + static getLogoutUrl() {
  362 + let url = HttpUrlUtils.hostUrl + "/api/rmrb-user-center/user/zh/c/logout";
  363 + return url;
  364 + }
  365 +
  366 +
353 static getResetPassworddUrl() { 367 static getResetPassworddUrl() {
354 let url = HttpUrlUtils.hostUrl + "/api/rmrb-user-center/user/zh/c/resetPassword"; 368 let url = HttpUrlUtils.hostUrl + "/api/rmrb-user-center/user/zh/c/resetPassword";
355 return url; 369 return url;
@@ -30,17 +30,18 @@ export default struct MinePageUserSimpleInfoUI { @@ -30,17 +30,18 @@ export default struct MinePageUserSimpleInfoUI {
30 build(){ 30 build(){
31 Row(){ 31 Row(){
32 //头像 32 //头像
33 - Stack({alignContent: Alignment.Center}){ 33 + Stack(){
34 Image(this.headPhotoUrl) 34 Image(this.headPhotoUrl)
35 .alt($r('app.media.default_head')) 35 .alt($r('app.media.default_head'))
36 .width('108lpx') 36 .width('108lpx')
37 .height('108lpx') 37 .height('108lpx')
38 - .objectFit(ImageFit.Auto) 38 + .objectFit(ImageFit.Cover)
39 .borderRadius(50) 39 .borderRadius(50)
40 Image(this.levelHead) 40 Image(this.levelHead)
41 .width('130lpx') 41 .width('130lpx')
42 .height('130lpx') 42 .height('130lpx')
43 - .objectFit(ImageFit.Auto) 43 + .objectFit(ImageFit.Cover)
  44 + .borderRadius(50)
44 }.width('130lpx') 45 }.width('130lpx')
45 .height('130lpx') 46 .height('130lpx')
46 .alignContent(Alignment.Center) 47 .alignContent(Alignment.Center)
@@ -80,7 +80,7 @@ export struct FollowFirstTabsComponent{ @@ -80,7 +80,7 @@ export struct FollowFirstTabsComponent{
80 this.currentIndex = index 80 this.currentIndex = index
81 }) 81 })
82 .width('100%') 82 .width('100%')
83 - .height('100%') 83 + .layoutWeight(1)
84 }.width('100%') 84 }.width('100%')
85 } 85 }
86 } 86 }
@@ -23,14 +23,14 @@ export struct FollowSecondTabsComponent{ @@ -23,14 +23,14 @@ export struct FollowSecondTabsComponent{
23 23
24 if(this.data != null){ 24 if(this.data != null){
25 if(this.data[this.firstIndex].children == null || this.data[this.firstIndex].children.length == 0){ 25 if(this.data[this.firstIndex].children == null || this.data[this.firstIndex].children.length == 0){
26 - FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].id}) 26 + FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].id}).layoutWeight(1)
27 }else{ 27 }else{
28 this.FollowSecondUI() 28 this.FollowSecondUI()
29 } 29 }
30 } 30 }
31 } 31 }
32 .width('100%') 32 .width('100%')
33 - .height('100%') 33 + .layoutWeight(1)
34 } 34 }
35 35
36 @Builder FollowSecondUI(){ 36 @Builder FollowSecondUI(){
@@ -128,7 +128,7 @@ export struct HomePageBottomComponent{ @@ -128,7 +128,7 @@ export struct HomePageBottomComponent{
128 List({ space: 3 }) { 128 List({ space: 3 }) {
129 LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { 129 LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
130 ListItem() { 130 ListItem() {
131 - ChildCommentComponent({data: item}) 131 + ChildCommentComponent({data: item,isLastItem:index===this.data_comment.totalCount()-1})
132 } 132 }
133 .onClick(() => { 133 .onClick(() => {
134 }) 134 })
@@ -158,7 +158,7 @@ export struct HomePageBottomComponent{ @@ -158,7 +158,7 @@ export struct HomePageBottomComponent{
158 }) 158 })
159 } 159 }
160 } 160 }
161 - }.height('100%') 161 + }.layoutWeight(1)
162 .justifyContent(FlexAlign.Start) 162 .justifyContent(FlexAlign.Start)
163 .width('100%') 163 .width('100%')
164 } 164 }
@@ -334,6 +334,7 @@ struct ChildFollowComponent { @@ -334,6 +334,7 @@ struct ChildFollowComponent {
334 @Component 334 @Component
335 struct ChildCommentComponent { 335 struct ChildCommentComponent {
336 @ObjectLink data: CommentListItem 336 @ObjectLink data: CommentListItem
  337 + isLastItem: boolean = false
337 338
338 build() { 339 build() {
339 Column(){ 340 Column(){
@@ -408,10 +409,12 @@ struct ChildCommentComponent { @@ -408,10 +409,12 @@ struct ChildCommentComponent {
408 .backgroundColor($r('app.color.color_F5F5F5')) 409 .backgroundColor($r('app.color.color_F5F5F5'))
409 .margin({top:'19lpx',bottom:'31lpx'}) 410 .margin({top:'19lpx',bottom:'31lpx'})
410 411
411 - Divider().width('100%')  
412 - .height('12lpx')  
413 - .strokeWidth('12lpx')  
414 - .backgroundColor($r('app.color.color_F5F5F5')) 412 + if(!this.isLastItem){
  413 + Divider().width('100%')
  414 + .height('12lpx')
  415 + .strokeWidth('12lpx')
  416 + .color($r('app.color.color_F5F5F5'))
  417 + }
415 418
416 } 419 }
417 .justifyContent(FlexAlign.Center) 420 .justifyContent(FlexAlign.Center)
@@ -37,7 +37,7 @@ export struct OtherHomePageBottomCommentComponent{ @@ -37,7 +37,7 @@ export struct OtherHomePageBottomCommentComponent{
37 List({ space: 3 }) { 37 List({ space: 3 }) {
38 LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { 38 LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
39 ListItem() { 39 ListItem() {
40 - ChildCommentComponent({data: item,levelHead:this.levelHead}) 40 + ChildCommentComponent({data: item,levelHead:this.levelHead,isLastItem:index===this.data_comment.totalCount()-1})
41 } 41 }
42 .onClick(() => { 42 .onClick(() => {
43 }) 43 })
@@ -68,6 +68,8 @@ export struct OtherHomePageBottomCommentComponent{ @@ -68,6 +68,8 @@ export struct OtherHomePageBottomCommentComponent{
68 } 68 }
69 } 69 }
70 .width('100%') 70 .width('100%')
  71 + .layoutWeight(1)
  72 + .justifyContent(FlexAlign.Start)
71 } 73 }
72 74
73 75
@@ -143,6 +145,7 @@ export struct OtherHomePageBottomCommentComponent{ @@ -143,6 +145,7 @@ export struct OtherHomePageBottomCommentComponent{
143 struct ChildCommentComponent { 145 struct ChildCommentComponent {
144 @ObjectLink data: CommentListItem 146 @ObjectLink data: CommentListItem
145 @Prop levelHead:string 147 @Prop levelHead:string
  148 + isLastItem: boolean = false
146 149
147 build() { 150 build() {
148 Column(){ 151 Column(){
@@ -234,10 +237,12 @@ struct ChildCommentComponent { @@ -234,10 +237,12 @@ struct ChildCommentComponent {
234 .backgroundColor($r('app.color.color_F5F5F5')) 237 .backgroundColor($r('app.color.color_F5F5F5'))
235 .margin({top:'19lpx',bottom:'31lpx'}) 238 .margin({top:'19lpx',bottom:'31lpx'})
236 239
237 - Divider().width('100%')  
238 - .height('12lpx')  
239 - .strokeWidth('12lpx')  
240 - .backgroundColor($r('app.color.color_F5F5F5')) 240 + if(!this.isLastItem){
  241 + Divider().width('100%')
  242 + .height('12lpx')
  243 + .strokeWidth('12lpx')
  244 + .color($r('app.color.color_F5F5F5'))
  245 + }
241 246
242 } 247 }
243 .justifyContent(FlexAlign.Center) 248 .justifyContent(FlexAlign.Center)
@@ -5,6 +5,7 @@ import EditInfoViewModel from '../../viewmodel/EditInfoViewModel'; @@ -5,6 +5,7 @@ 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';
8 9
9 10
10 @Entry 11 @Entry
@@ -25,6 +26,10 @@ struct EditUserInfoPage { @@ -25,6 +26,10 @@ struct EditUserInfoPage {
25 this.getAreaList() 26 this.getAreaList()
26 } 27 }
27 28
  29 + onPageShow(){
  30 +
  31 + }
  32 +
28 build() { 33 build() {
29 Row() { 34 Row() {
30 Column() { 35 Column() {
@@ -89,7 +94,6 @@ struct EditUserInfoPage { @@ -89,7 +94,6 @@ struct EditUserInfoPage {
89 .width('100%') 94 .width('100%')
90 .onClick(()=>{ 95 .onClick(()=>{
91 if (i === 1){ 96 if (i === 1){
92 - // WDRouterRule.jumpWithPage(WDRouterPage.editUserInfoPage)  
93 WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage) 97 WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage)
94 }else if (i === 2){ 98 }else if (i === 2){
95 WDRouterRule.jumpWithPage(WDRouterPage.editUserIntroductionPage) 99 WDRouterRule.jumpWithPage(WDRouterPage.editUserIntroductionPage)
1 import { CustomTitleUI } from '../reusable/CustomTitleUI' 1 import { CustomTitleUI } from '../reusable/CustomTitleUI'
  2 +import router from '@ohos.router'
2 3
3 @Entry 4 @Entry
4 @Component 5 @Component
5 struct EditUserIntroductionPage { 6 struct EditUserIntroductionPage {
6 @State numCount: number = 0 7 @State numCount: number = 0
7 @State textColor : string = '#222222' 8 @State textColor : string = '#222222'
  9 + @State introduction: string = ''
8 10
9 build() { 11 build() {
10 Column(){ 12 Column(){
@@ -23,6 +25,7 @@ struct EditUserIntroductionPage { @@ -23,6 +25,7 @@ struct EditUserIntroductionPage {
23 }else { 25 }else {
24 this.textColor = '#222222' 26 this.textColor = '#222222'
25 } 27 }
  28 + this.introduction = value
26 }) 29 })
27 30
28 Text(this.numCount.toString() + '/60') 31 Text(this.numCount.toString() + '/60')
@@ -46,6 +49,12 @@ struct EditUserIntroductionPage { @@ -46,6 +49,12 @@ struct EditUserIntroductionPage {
46 .backgroundColor('#ED2800') 49 .backgroundColor('#ED2800')
47 .borderRadius(5) 50 .borderRadius(5)
48 .margin(30) 51 .margin(30)
  52 + .onClick(()=>{
  53 + router.back({
  54 + url:'',
  55 + params:{nikeName:this.introduction}
  56 + })
  57 + })
49 } 58 }
50 } 59 }
51 } 60 }
1 import { CustomTitleUI } from '../reusable/CustomTitleUI' 1 import { CustomTitleUI } from '../reusable/CustomTitleUI'
  2 +import router from '@ohos.router'
2 3
3 @Entry 4 @Entry
4 @Component 5 @Component
@@ -6,6 +7,7 @@ struct EditUserNikeNamePage { @@ -6,6 +7,7 @@ struct EditUserNikeNamePage {
6 ///接收传参 7 ///接收传参
7 @State numCount: number = 0 8 @State numCount: number = 0
8 @State textColor : string = '#222222' 9 @State textColor : string = '#222222'
  10 + @State nikeName: string = ''
9 11
10 build() { 12 build() {
11 Column(){ 13 Column(){
@@ -24,6 +26,7 @@ struct EditUserNikeNamePage { @@ -24,6 +26,7 @@ struct EditUserNikeNamePage {
24 }else { 26 }else {
25 this.textColor = '#222222' 27 this.textColor = '#222222'
26 } 28 }
  29 + this.nikeName = value
27 }) 30 })
28 31
29 Text(this.numCount.toString() + '/16') 32 Text(this.numCount.toString() + '/16')
@@ -46,6 +49,12 @@ struct EditUserNikeNamePage { @@ -46,6 +49,12 @@ struct EditUserNikeNamePage {
46 .backgroundColor('#ED2800') 49 .backgroundColor('#ED2800')
47 .borderRadius(5) 50 .borderRadius(5)
48 .margin(30) 51 .margin(30)
  52 + .onClick(()=>{
  53 + router.back({
  54 + url:'',
  55 + params:{nikeName:this.nikeName}
  56 + })
  57 + })
49 } 58 }
50 } 59 }
51 } 60 }
@@ -51,9 +51,7 @@ struct MyCollectionListPage { @@ -51,9 +51,7 @@ struct MyCollectionListPage {
51 51
52 LazyForEach(this.browSingModel.compList, (compDTO: CompDTO, compIndex: number) => { 52 LazyForEach(this.browSingModel.compList, (compDTO: CompDTO, compIndex: number) => {
53 ListItem() { 53 ListItem() {
54 - Column() {  
55 - CompParser({ compDTO: compDTO, compIndex: compIndex });  
56 - } 54 + this.newCompParser(compDTO,compIndex)
57 } 55 }
58 }) 56 })
59 57
@@ -72,6 +70,23 @@ struct MyCollectionListPage { @@ -72,6 +70,23 @@ struct MyCollectionListPage {
72 .height(CommonConstants.FULL_PARENT) 70 .height(CommonConstants.FULL_PARENT)
73 } 71 }
74 72
  73 + @Builder
  74 + newCompParser(compDTO: CompDTO, compIndex: number){
  75 + Row(){
  76 + Button()
  77 + .type(ButtonType.Normal)
  78 + .width('20')
  79 + .height('20')
  80 + .backgroundColor('#ED2800')
  81 + .borderRadius(5)
  82 + .margin({left:16})
  83 +
  84 + Column() {
  85 + CompParser({ compDTO: compDTO, compIndex: compIndex });
  86 + }
  87 + }
  88 + }
  89 +
75 @Builder LoadingLayout() { 90 @Builder LoadingLayout() {
76 CustomRefreshLoadLayout({ refreshBean: new RefreshLayoutBean(true, 91 CustomRefreshLoadLayout({ refreshBean: new RefreshLayoutBean(true,
77 $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.browSingModel.pullDownRefreshHeight) }) 92 $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.browSingModel.pullDownRefreshHeight) })
  1 +import { Logger } from 'wdKit';
1 import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel'; 2 import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel';
2 import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel'; 3 import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel';
3 import { FirstLevelComponent } from './FirstLevelComponent'; 4 import { FirstLevelComponent } from './FirstLevelComponent';
@@ -13,12 +14,6 @@ export struct AreaPickerDialog { @@ -13,12 +14,6 @@ export struct AreaPickerDialog {
13 @Provide dataSource: AreaListModel[] = [] 14 @Provide dataSource: AreaListModel[] = []
14 result: JSON[] = []; 15 result: JSON[] = [];
15 16
16 - aboutToAppear(){  
17 - this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[0])  
18 - this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.dataSource[0].children[0])  
19 - this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.dataSource[0].children[0].children[0])  
20 - }  
21 -  
22 build() { 17 build() {
23 Column(){ 18 Column(){
24 Row(){ 19 Row(){
@@ -39,7 +34,8 @@ export struct AreaPickerDialog { @@ -39,7 +34,8 @@ export struct AreaPickerDialog {
39 34
40 Button('确定',{type:ButtonType.Normal}) 35 Button('确定',{type:ButtonType.Normal})
41 .onClick(()=> { 36 .onClick(()=> {
42 - 37 + this.controller.close()
  38 + Logger.info('area',this.currentFirst.label+this.currentSecondBean.label+this.currentThirdBean.label);
43 }) 39 })
44 .backgroundColor(0xffffff) 40 .backgroundColor(0xffffff)
45 .fontColor(Color.Blue) 41 .fontColor(Color.Blue)
@@ -12,6 +12,7 @@ export struct FirstLevelComponent { @@ -12,6 +12,7 @@ export struct FirstLevelComponent {
12 const element = this.dataSource[index]; 12 const element = this.dataSource[index];
13 this.labelList.push(element.label) 13 this.labelList.push(element.label)
14 } 14 }
  15 + this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[this.select])
15 } 16 }
16 17
17 build() { 18 build() {
@@ -21,10 +22,10 @@ export struct FirstLevelComponent { @@ -21,10 +22,10 @@ export struct FirstLevelComponent {
21 Text('暂无数据').fontSize(20) 22 Text('暂无数据').fontSize(20)
22 }else { 23 }else {
23 TextPicker({range:this.labelList,selected:this.select}) 24 TextPicker({range:this.labelList,selected:this.select})
24 - // .onChange((value:string,index:number) => {  
25 - // this.select = index  
26 - // this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[index])  
27 - // }) 25 + .onChange((value: string | string[], index: number | number[]) => {
  26 + this.select = index as number
  27 + this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[index as number])
  28 + })
28 .backgroundColor(Color.White) 29 .backgroundColor(Color.White)
29 .border({color:'#e2e2e2',width:{right:0.5}}) 30 .border({color:'#e2e2e2',width:{right:0.5}})
30 .width('100%') 31 .width('100%')
1 import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel'; 1 import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel';
2 - 2 +import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel';
3 @Component 3 @Component
4 export struct SecondLevelComponent { 4 export struct SecondLevelComponent {
5 @State mTip: string = '暂无数据' 5 @State mTip: string = '暂无数据'
@@ -8,13 +8,6 @@ export struct SecondLevelComponent { @@ -8,13 +8,6 @@ export struct SecondLevelComponent {
8 @Consume @Watch('onFirstChange') currentFirst: AreaListManageModel; 8 @Consume @Watch('onFirstChange') currentFirst: AreaListManageModel;
9 @Consume currentSecondBean: AreaListManageModel 9 @Consume currentSecondBean: AreaListManageModel
10 10
11 - aboutToAppear(){  
12 - for (let index = 0; index < this.currentFirst.children.length; index++) {  
13 - const element = this.currentFirst.children[index];  
14 - this.labelList.push(element.label)  
15 - }  
16 - }  
17 -  
18 build() { 11 build() {
19 Column(){ 12 Column(){
20 Column(){ 13 Column(){
@@ -22,10 +15,10 @@ export struct SecondLevelComponent { @@ -22,10 +15,10 @@ export struct SecondLevelComponent {
22 Text(this.mTip).fontSize(20) 15 Text(this.mTip).fontSize(20)
23 }else { 16 }else {
24 TextPicker({range:this.labelList,selected:this.select}) 17 TextPicker({range:this.labelList,selected:this.select})
25 - // .onChange((value:string,index:number) => {  
26 - // this.select = index  
27 - // this.currentSecondBean = this.currentFirst.children[index]  
28 - // }) 18 + .onChange((value: string | string[], index: number | number[]) => {
  19 + this.select = index as number
  20 + this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[index as number])
  21 + })
29 .backgroundColor(Color.White) 22 .backgroundColor(Color.White)
30 .border({color:'#e2e2e2',width:{right:0.5}}) 23 .border({color:'#e2e2e2',width:{right:0.5}})
31 .width('100%') 24 .width('100%')
@@ -47,7 +40,7 @@ export struct SecondLevelComponent { @@ -47,7 +40,7 @@ export struct SecondLevelComponent {
47 const element = this.currentFirst.children[index]; 40 const element = this.currentFirst.children[index];
48 this.labelList.push(element.label) 41 this.labelList.push(element.label)
49 } 42 }
50 - // this.currentSecondBean = this.currentFirst.children[this.select] 43 + this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[this.select])
51 } 44 }
52 } 45 }
53 } 46 }
1 import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel'; 1 import { AreaListManageModel, AreaListModel } from '../../../model/AreaListModel';
2 - 2 +import EditInfoViewModel from '../../../viewmodel/EditInfoViewModel';
3 @Component 3 @Component
4 export struct ThirdLevelComponent { 4 export struct ThirdLevelComponent {
5 @State mTip: string = '暂无数据' 5 @State mTip: string = '暂无数据'
@@ -9,13 +9,6 @@ export struct ThirdLevelComponent { @@ -9,13 +9,6 @@ export struct ThirdLevelComponent {
9 @Consume @Watch('onSecondChange') currentSecondBean: AreaListManageModel; 9 @Consume @Watch('onSecondChange') currentSecondBean: AreaListManageModel;
10 @Consume currentThirdBean: AreaListManageModel 10 @Consume currentThirdBean: AreaListManageModel
11 11
12 - aboutToAppear(){  
13 - for (let index = 0; index < this.currentSecondBean.children.length; index++) {  
14 - const element = this.currentSecondBean.children[index];  
15 - this.labelList.push(element.label)  
16 - }  
17 - }  
18 -  
19 build() { 12 build() {
20 Column(){ 13 Column(){
21 Column(){ 14 Column(){
@@ -23,10 +16,10 @@ export struct ThirdLevelComponent { @@ -23,10 +16,10 @@ export struct ThirdLevelComponent {
23 Text(this.mTip).fontSize(20) 16 Text(this.mTip).fontSize(20)
24 }else { 17 }else {
25 TextPicker({range:this.labelList,selected:this.select}) 18 TextPicker({range:this.labelList,selected:this.select})
26 - // .onChange((value:string,index:number) => {  
27 - // this.select = index  
28 - // this.currentThirdBean = this.currentSecondBean.children[index]  
29 - // }) 19 + .onChange((value: string | string[], index: number | number[]) => {
  20 + this.select = index as number
  21 + this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[index as number])
  22 + })
30 .backgroundColor(Color.White) 23 .backgroundColor(Color.White)
31 .border({color:'#e2e2e2',width:{right:0.5}}) 24 .border({color:'#e2e2e2',width:{right:0.5}})
32 .width('100%') 25 .width('100%')
@@ -52,7 +45,7 @@ export struct ThirdLevelComponent { @@ -52,7 +45,7 @@ export struct ThirdLevelComponent {
52 const element = this.currentSecondBean.children[index]; 45 const element = this.currentSecondBean.children[index];
53 this.labelList.push(element.label) 46 this.labelList.push(element.label)
54 } 47 }
55 - // this.currentThirdBean = this.currentSecondBean.children[this.select] 48 + this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[this.select])
56 } 49 }
57 } 50 }
58 } 51 }
@@ -197,16 +197,15 @@ struct MineHomePage { @@ -197,16 +197,15 @@ struct MineHomePage {
197 this.currentIndex = index 197 this.currentIndex = index
198 }) 198 })
199 .vertical(false) 199 .vertical(false)
200 - .height("100%")  
201 }.width("100%") 200 }.width("100%")
202 } 201 }
203 .edgeEffect(EdgeEffect.None) 202 .edgeEffect(EdgeEffect.None)
204 .scrollBar(BarState.Off) 203 .scrollBar(BarState.Off)
205 .width('100%') 204 .width('100%')
206 - .height('100%') 205 + .layoutWeight(1)
207 } 206 }
208 }.width('100%') 207 }.width('100%')
209 - .height('100%') 208 + .layoutWeight(1)
210 209
211 } 210 }
212 @Builder MineHomeTitleTransparent() { 211 @Builder MineHomeTitleTransparent() {
@@ -190,16 +190,15 @@ struct OtherNormalUserHomePage { @@ -190,16 +190,15 @@ struct OtherNormalUserHomePage {
190 this.currentIndex = index 190 this.currentIndex = index
191 }) 191 })
192 .vertical(false) 192 .vertical(false)
193 - .height("100%")  
194 }.width("100%") 193 }.width("100%")
195 } 194 }
196 .edgeEffect(EdgeEffect.None) 195 .edgeEffect(EdgeEffect.None)
197 .scrollBar(BarState.Off) 196 .scrollBar(BarState.Off)
198 .width('100%') 197 .width('100%')
199 - .height('100%') 198 + .layoutWeight(1)
200 } 199 }
201 }.width('100%') 200 }.width('100%')
202 - .height('100%') 201 + .layoutWeight(1)
203 202
204 } 203 }
205 @Builder MineHomeTitleTransparent() { 204 @Builder MineHomeTitleTransparent() {
@@ -221,5 +221,30 @@ export class LoginModel { @@ -221,5 +221,30 @@ export class LoginModel {
221 }) 221 })
222 } 222 }
223 223
  224 + //退出登录
  225 + logOut() {
  226 + let bean: Record<string, string> = {};
  227 + bean['refreshToken'] = HttpUrlUtils.getRefreshToken();
  228 +
  229 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  230 +
  231 + return new Promise<string>((success, fail) => {
  232 + HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.getLogoutUrl(), bean, headers).then((data: ResponseDTO<string>) => {
  233 + if (!data || !data.data) {
  234 + fail("数据为空")
  235 + return
  236 + }
  237 + if (data.code != 0) {
  238 + fail(data.message)
  239 + return
  240 + }
  241 + success(data.data)
  242 + }, (error: Error) => {
  243 + fail(error.message)
  244 + Logger.debug("LoginViewModel:error ", error.toString())
  245 + })
  246 + })
  247 + }
  248 +
224 } 249 }
225 250
@@ -139,10 +139,25 @@ export class LoginViewModel { @@ -139,10 +139,25 @@ export class LoginViewModel {
139 fail(message) 139 fail(message)
140 }) 140 })
141 }) 141 })
  142 + }
142 143
  144 + // 登出
  145 + logOut(){
  146 + return new Promise<string>(async (success, fail) => {
  147 + this.loginModel.logOut().then((data) => {
  148 + //清除登录状态以及token、userid等信息
  149 + HttpUrlUtils.setUserId('');
  150 + HttpUrlUtils.setUserType('');
  151 + HttpUrlUtils.setUserToken('');
  152 + success(data)
  153 + }).catch((message: string) => {
  154 + fail(message)
  155 + })
  156 + })
143 } 157 }
144 158
145 159
  160 +
146 async doMd(content: string): Promise<string> { 161 async doMd(content: string): Promise<string> {
147 let mdAlgName = 'SHA256'; // 摘要算法名 162 let mdAlgName = 'SHA256'; // 摘要算法名
148 let message = content; // 待摘要的数据 163 let message = content; // 待摘要的数据