张善主

Merge remote-tracking branch 'origin/main'

@@ -72,6 +72,10 @@ export class UserDataLocal { @@ -72,6 +72,10 @@ export class UserDataLocal {
72 SPHelper.default.save(UserDataLocal.USER_HEADER_URL, url) 72 SPHelper.default.save(UserDataLocal.USER_HEADER_URL, url)
73 } 73 }
74 74
  75 + public static setUserType(type:string) {
  76 + SPHelper.default.save(UserDataLocal.USER_Type, type)
  77 + }
  78 +
75 public static setUserFollowOperation(timestamp:string) { 79 public static setUserFollowOperation(timestamp:string) {
76 SPHelper.default.saveSync(UserDataLocal.USER_FOLLOW_OPERATION, timestamp) 80 SPHelper.default.saveSync(UserDataLocal.USER_FOLLOW_OPERATION, timestamp)
77 } 81 }
@@ -9,13 +9,13 @@ export default struct MinePageUserSimpleInfoUI { @@ -9,13 +9,13 @@ export default struct MinePageUserSimpleInfoUI {
9 @Watch('loginStateChange') @Prop isLogin :boolean 9 @Watch('loginStateChange') @Prop isLogin :boolean
10 @State userName:string = "登陆注册" 10 @State userName:string = "登陆注册"
11 @State headPhotoUrl:string = "" 11 @State headPhotoUrl:string = ""
  12 + userType:string = "1"
12 @State levelHead:string = "" 13 @State levelHead:string = ""
13 @State levelId:number = 0 14 @State levelId:number = 0
14 15
15 loginStateChange(){ 16 loginStateChange(){
16 if(this.isLogin){ 17 if(this.isLogin){
17 this.getUserInfo() 18 this.getUserInfo()
18 - this.getUserLevel()  
19 }else{ 19 }else{
20 this.headPhotoUrl = "" 20 this.headPhotoUrl = ""
21 this.levelHead = "" 21 this.levelHead = ""
@@ -54,8 +54,10 @@ export default struct MinePageUserSimpleInfoUI { @@ -54,8 +54,10 @@ export default struct MinePageUserSimpleInfoUI {
54 Text(this.userName) 54 Text(this.userName)
55 .fontColor($r('app.color.color_222222')) 55 .fontColor($r('app.color.color_222222'))
56 .maxLines(1) 56 .maxLines(1)
  57 + .fontWeight(FontWeight.Bold)
57 .textOverflow({ overflow: TextOverflow.Ellipsis }) 58 .textOverflow({ overflow: TextOverflow.Ellipsis })
58 .fontSize('33lpx') 59 .fontSize('33lpx')
  60 + .lineHeight("46lpx")
59 61
60 Image($r('app.media.mine_user_edit')) 62 Image($r('app.media.mine_user_edit'))
61 .width('27lpx') 63 .width('27lpx')
@@ -144,7 +146,21 @@ export default struct MinePageUserSimpleInfoUI { @@ -144,7 +146,21 @@ export default struct MinePageUserSimpleInfoUI {
144 this.userName = value.userName 146 this.userName = value.userName
145 this.headPhotoUrl = value.headPhotoUrl 147 this.headPhotoUrl = value.headPhotoUrl
146 UserDataLocal.setUserHeaderUrl(value.headPhotoUrl) 148 UserDataLocal.setUserHeaderUrl(value.headPhotoUrl)
  149 +
  150 + this.userType = value.userType
  151 + UserDataLocal.setUserType(value.userType)
  152 +
  153 + if(this.userType === "1"){
  154 + if(StringUtils.isNotEmpty(value.honoraryIcon)){
  155 + this.levelHead = value.honoraryIcon
  156 + return
  157 + }
  158 + if(StringUtils.isNotEmpty(value.avatarFrame)){
  159 + this.levelHead = value.avatarFrame
  160 + }
147 } 161 }
  162 + }
  163 + this.getUserLevel()
148 }).catch((err:Error)=>{ 164 }).catch((err:Error)=>{
149 console.log(TAG,JSON.stringify(err)) 165 console.log(TAG,JSON.stringify(err))
150 }) 166 })
@@ -152,10 +168,14 @@ export default struct MinePageUserSimpleInfoUI { @@ -152,10 +168,14 @@ export default struct MinePageUserSimpleInfoUI {
152 getUserLevel(){ 168 getUserLevel(){
153 MinePageDatasModel.getUserLevelData(getContext(this)).then((value)=>{ 169 MinePageDatasModel.getUserLevelData(getContext(this)).then((value)=>{
154 if(value!=null){ 170 if(value!=null){
  171 + if(StringUtils.isEmpty(this.levelHead)){
  172 + if(this.userType === "1"){
155 this.levelHead = value.levelHead 173 this.levelHead = value.levelHead
  174 + }
  175 + }
156 this.levelId = value.levelId 176 this.levelId = value.levelId
157 - UserDataLocal.setUserLevel(value.levelId)  
158 - UserDataLocal.setUserLevelHeaderUrl(value.levelHead + "") 177 + UserDataLocal.setUserLevel(this.levelId)
  178 + UserDataLocal.setUserLevelHeaderUrl(this.levelHead + "")
159 } 179 }
160 }).catch((err:Error)=>{ 180 }).catch((err:Error)=>{
161 console.log(TAG,JSON.stringify(err)) 181 console.log(TAG,JSON.stringify(err))
@@ -108,12 +108,14 @@ export struct SearchComponent { @@ -108,12 +108,14 @@ export struct SearchComponent {
108 SearchHistoryComponent({ searchHistoryData: $searchHistoryData, onDelHistory: (): void => this.getSearchHistoryData(),onGetSearchRes: (item,index): void => this.getSearchHistoryResData(item,index) }) 108 SearchHistoryComponent({ searchHistoryData: $searchHistoryData, onDelHistory: (): void => this.getSearchHistoryData(),onGetSearchRes: (item,index): void => this.getSearchHistoryResData(item,index) })
109 } 109 }
110 110
  111 + if(this.searchHistoryData.length>0){
111 //分隔符 112 //分隔符
112 Divider() 113 Divider()
113 .width('100%') 114 .width('100%')
114 .height('1lpx') 115 .height('1lpx')
115 .color($r('app.color.color_EDEDED')) 116 .color($r('app.color.color_EDEDED'))
116 .strokeWidth('1lpx') 117 .strokeWidth('1lpx')
  118 + }
117 119
118 SearchHotsComponent({onGetSearchRes: (item): void => this.getSearchHotResData(item)}) 120 SearchHotsComponent({onGetSearchRes: (item): void => this.getSearchHotResData(item)})
119 } 121 }
@@ -123,7 +125,6 @@ export struct SearchComponent { @@ -123,7 +125,6 @@ export struct SearchComponent {
123 .width('100%') 125 .width('100%')
124 .height('100%') 126 .height('100%')
125 .padding({ left: '31lpx', right: '31lpx' }) 127 .padding({ left: '31lpx', right: '31lpx' })
126 - .margin({ top: '36lpx' })  
127 } else { 128 } else {
128 if (this.hasChooseSearch) { 129 if (this.hasChooseSearch) {
129 //搜索结果 130 //搜索结果
@@ -120,7 +120,7 @@ export struct SearchHistoryComponent{ @@ -120,7 +120,7 @@ export struct SearchHistoryComponent{
120 .columnsTemplate('1fr 1fr') 120 .columnsTemplate('1fr 1fr')
121 .rowsGap('23lpx') 121 .rowsGap('23lpx')
122 } 122 }
123 - .margin({bottom:'46lpx'}) 123 + .margin({top:"36lpx",bottom:'46lpx'})
124 } 124 }
125 125
126 getCategoryRowCount() { 126 getCategoryRowCount() {
@@ -41,19 +41,19 @@ export struct SearchHotsComponent{ @@ -41,19 +41,19 @@ export struct SearchHotsComponent{
41 41
42 Text("热门搜索") 42 Text("热门搜索")
43 .textAlign(TextAlign.Center) 43 .textAlign(TextAlign.Center)
44 - .fontWeight('600lpx') 44 + .fontWeight(FontWeight.Bold)
45 .fontSize('33lpx') 45 .fontSize('33lpx')
46 .lineHeight('46lpx') 46 .lineHeight('46lpx')
47 .fontColor($r('app.color.color_222222')) 47 .fontColor($r('app.color.color_222222'))
48 - .height('38lpx') 48 + .height('46lpx')
49 } 49 }
50 .width('100%') 50 .width('100%')
  51 + .margin({bottom:"15lpx"})
51 52
52 List(){ 53 List(){
53 ForEach(this.searchHotsData,(item:SearchHotContentItem,index:number)=>{ 54 ForEach(this.searchHotsData,(item:SearchHotContentItem,index:number)=>{
54 ListItem(){ 55 ListItem(){
55 Column(){ 56 Column(){
56 - Column(){  
57 Row(){ 57 Row(){
58 Row(){ 58 Row(){
59 if(item.sequence <=3){ 59 if(item.sequence <=3){
@@ -80,6 +80,7 @@ export struct SearchHotsComponent{ @@ -80,6 +80,7 @@ export struct SearchHotsComponent{
80 .fontWeight('400lpx') 80 .fontWeight('400lpx')
81 .lineHeight('42lpx') 81 .lineHeight('42lpx')
82 }.layoutWeight(1) 82 }.layoutWeight(1)
  83 +
83 if(item.mark===1 || item.mark===2){ 84 if(item.mark===1 || item.mark===2){
84 Image(item.mark===1?$r('app.media.search_hots_mark1'):$r('app.media.search_hots_mark2')) 85 Image(item.mark===1?$r('app.media.search_hots_mark1'):$r('app.media.search_hots_mark2'))
85 .width('42lpx') 86 .width('42lpx')
@@ -89,6 +90,7 @@ export struct SearchHotsComponent{ @@ -89,6 +90,7 @@ export struct SearchHotsComponent{
89 } 90 }
90 }.alignItems(VerticalAlign.Center) 91 }.alignItems(VerticalAlign.Center)
91 .height('84lpx') 92 .height('84lpx')
  93 + .width('100%')
92 .justifyContent(FlexAlign.SpaceBetween) 94 .justifyContent(FlexAlign.SpaceBetween)
93 95
94 if(index != this.searchHotsData.length-1 ){ 96 if(index != this.searchHotsData.length-1 ){
@@ -98,18 +100,15 @@ export struct SearchHotsComponent{ @@ -98,18 +100,15 @@ export struct SearchHotsComponent{
98 .color($r('app.color.color_F5F5F5')) 100 .color($r('app.color.color_F5F5F5'))
99 .strokeWidth('1lpx') 101 .strokeWidth('1lpx')
100 } 102 }
101 - }.height('108lpx')  
102 - .justifyContent(FlexAlign.Center) 103 + }.height('85lpx')
  104 + .width('100%')
103 .alignItems(HorizontalAlign.Start) 105 .alignItems(HorizontalAlign.Start)
104 - .padding({left:'27lpx'})  
105 - }  
106 } 106 }
107 .onClick(()=>{ 107 .onClick(()=>{
108 if (this.onGetSearchRes !== undefined) { 108 if (this.onGetSearchRes !== undefined) {
109 this.onGetSearchRes(item.hotEntry) 109 this.onGetSearchRes(item.hotEntry)
110 } 110 }
111 }) 111 })
112 - .height('117lpx')  
113 }) 112 })
114 }.onScrollFrameBegin((offset, state) => { 113 }.onScrollFrameBegin((offset, state) => {
115 return { offsetRemain: 0 } 114 return { offsetRemain: 0 }
@@ -20,6 +20,7 @@ struct MineHomePage { @@ -20,6 +20,7 @@ struct MineHomePage {
20 @State userName:string = "" 20 @State userName:string = ""
21 @State headPhotoUrl:string = "" 21 @State headPhotoUrl:string = ""
22 @State levelHead:string = "" 22 @State levelHead:string = ""
  23 + userType:string = "1"
23 @State levelId:number = 0 24 @State levelId:number = 0
24 @State desc:string = "点击添加简介,让大家认识你" //text 搞两个样式,如果三行,就显示 另外一个text 没有显示高度的 25 @State desc:string = "点击添加简介,让大家认识你" //text 搞两个样式,如果三行,就显示 另外一个text 没有显示高度的
25 @State isHasIntroduction: boolean = false 26 @State isHasIntroduction: boolean = false
@@ -31,7 +32,6 @@ struct MineHomePage { @@ -31,7 +32,6 @@ struct MineHomePage {
31 32
32 onPageShow(): void { 33 onPageShow(): void {
33 this.getUserInfo() 34 this.getUserInfo()
34 - this.getUserLevel()  
35 } 35 }
36 36
37 build() { 37 build() {
@@ -403,7 +403,20 @@ struct MineHomePage { @@ -403,7 +403,20 @@ struct MineHomePage {
403 this.attentionNum = value.attentionNum 403 this.attentionNum = value.attentionNum
404 this.registTime = value.registTime 404 this.registTime = value.registTime
405 this.getRegisterDays() 405 this.getRegisterDays()
  406 +
  407 + this.userType = value.userType
  408 +
  409 + if(this.userType === "1"){
  410 + if(StringUtils.isNotEmpty(value.honoraryIcon)){
  411 + this.levelHead = value.honoraryIcon
  412 + return
  413 + }
  414 + if(StringUtils.isNotEmpty(value.avatarFrame)){
  415 + this.levelHead = value.avatarFrame
  416 + }
406 } 417 }
  418 + }
  419 + this.getUserLevel()
407 }).catch((err:Error)=>{ 420 }).catch((err:Error)=>{
408 console.log(TAG,JSON.stringify(err)) 421 console.log(TAG,JSON.stringify(err))
409 }) 422 })
@@ -411,7 +424,11 @@ struct MineHomePage { @@ -411,7 +424,11 @@ struct MineHomePage {
411 getUserLevel(){ 424 getUserLevel(){
412 MinePageDatasModel.getUserLevelData(getContext(this)).then((value)=>{ 425 MinePageDatasModel.getUserLevelData(getContext(this)).then((value)=>{
413 if(value!=null){ 426 if(value!=null){
  427 + if(StringUtils.isEmpty(this.levelHead)){
  428 + if(this.userType === "1"){
414 this.levelHead = value.levelHead 429 this.levelHead = value.levelHead
  430 + }
  431 + }
415 this.levelId = value.levelId 432 this.levelId = value.levelId
416 } 433 }
417 }).catch((err:Error)=>{ 434 }).catch((err:Error)=>{
@@ -38,10 +38,10 @@ struct OtherNormalUserHomePage { @@ -38,10 +38,10 @@ struct OtherNormalUserHomePage {
38 @State commentNum:number = 0//评论数 38 @State commentNum:number = 0//评论数
39 @State attentionNum:number = 0//关注数 39 @State attentionNum:number = 0//关注数
40 @State desc:string = "" 40 @State desc:string = ""
  41 + userType:string = "1"
41 42
42 aboutToAppear(){ 43 aboutToAppear(){
43 this.getUserInfo() 44 this.getUserInfo()
44 - this.getUserLevel()  
45 } 45 }
46 46
47 47
@@ -348,7 +348,20 @@ struct OtherNormalUserHomePage { @@ -348,7 +348,20 @@ struct OtherNormalUserHomePage {
348 this.browseNum = StringUtils.isEmpty(value.browseNum)?0:value.browseNum 348 this.browseNum = StringUtils.isEmpty(value.browseNum)?0:value.browseNum
349 this.commentNum = StringUtils.isEmpty(value.commentNum)?0:value.commentNum 349 this.commentNum = StringUtils.isEmpty(value.commentNum)?0:value.commentNum
350 this.attentionNum = StringUtils.isEmpty(value.attentionNum)?0:value.attentionNum 350 this.attentionNum = StringUtils.isEmpty(value.attentionNum)?0:value.attentionNum
  351 +
  352 + this.userType = value.userType
  353 +
  354 + if(this.userType === "1"){
  355 + if(StringUtils.isNotEmpty(value.honoraryIcon)){
  356 + this.levelHead = value.honoraryIcon
  357 + return
  358 + }
  359 + if(StringUtils.isNotEmpty(value.avatarFrame)){
  360 + this.levelHead = value.avatarFrame
351 } 361 }
  362 + }
  363 + }
  364 + this.getUserLevel()
352 }).catch((err:Error)=>{ 365 }).catch((err:Error)=>{
353 console.log(TAG,JSON.stringify(err)) 366 console.log(TAG,JSON.stringify(err))
354 }) 367 })
@@ -359,7 +372,11 @@ struct OtherNormalUserHomePage { @@ -359,7 +372,11 @@ struct OtherNormalUserHomePage {
359 } 372 }
360 MinePageDatasModel.getOtherUserLevelData([this.curUserId],getContext(this)).then((value)=>{ 373 MinePageDatasModel.getOtherUserLevelData([this.curUserId],getContext(this)).then((value)=>{
361 if(value!=null){ 374 if(value!=null){
  375 + if(StringUtils.isEmpty(this.levelHead)){
  376 + if(this.userType === "1"){
362 this.levelHead = value[0].levelHead 377 this.levelHead = value[0].levelHead
  378 + }
  379 + }
363 this.levelId = value[0].level 380 this.levelId = value[0].level
364 } 381 }
365 }).catch((err:Error)=>{ 382 }).catch((err:Error)=>{
@@ -9,4 +9,10 @@ export class MineUserDetailItem{ @@ -9,4 +9,10 @@ export class MineUserDetailItem{
9 commentNum:number = 0//评论数 9 commentNum:number = 0//评论数
10 attentionNum:number = 0//关注数 10 attentionNum:number = 0//关注数
11 registTime:number = 0//账号注册时间 11 registTime:number = 0//账号注册时间
  12 +
  13 + honoraryIcon = ""//荣誉称号 (优先)
  14 + avatarFrame:string = ""//最佳评论员头像框地址
  15 +
  16 +
  17 +
12 } 18 }