张善主

Merge remote-tracking branch 'origin/main'

... ... @@ -72,6 +72,10 @@ export class UserDataLocal {
SPHelper.default.save(UserDataLocal.USER_HEADER_URL, url)
}
public static setUserType(type:string) {
SPHelper.default.save(UserDataLocal.USER_Type, type)
}
public static setUserFollowOperation(timestamp:string) {
SPHelper.default.saveSync(UserDataLocal.USER_FOLLOW_OPERATION, timestamp)
}
... ...
... ... @@ -9,13 +9,13 @@ export default struct MinePageUserSimpleInfoUI {
@Watch('loginStateChange') @Prop isLogin :boolean
@State userName:string = "登陆注册"
@State headPhotoUrl:string = ""
userType:string = "1"
@State levelHead:string = ""
@State levelId:number = 0
loginStateChange(){
if(this.isLogin){
this.getUserInfo()
this.getUserLevel()
}else{
this.headPhotoUrl = ""
this.levelHead = ""
... ... @@ -54,8 +54,10 @@ export default struct MinePageUserSimpleInfoUI {
Text(this.userName)
.fontColor($r('app.color.color_222222'))
.maxLines(1)
.fontWeight(FontWeight.Bold)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize('33lpx')
.lineHeight("46lpx")
Image($r('app.media.mine_user_edit'))
.width('27lpx')
... ... @@ -144,7 +146,21 @@ export default struct MinePageUserSimpleInfoUI {
this.userName = value.userName
this.headPhotoUrl = value.headPhotoUrl
UserDataLocal.setUserHeaderUrl(value.headPhotoUrl)
this.userType = value.userType
UserDataLocal.setUserType(value.userType)
if(this.userType === "1"){
if(StringUtils.isNotEmpty(value.honoraryIcon)){
this.levelHead = value.honoraryIcon
return
}
if(StringUtils.isNotEmpty(value.avatarFrame)){
this.levelHead = value.avatarFrame
}
}
}
this.getUserLevel()
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
})
... ... @@ -152,10 +168,14 @@ export default struct MinePageUserSimpleInfoUI {
getUserLevel(){
MinePageDatasModel.getUserLevelData(getContext(this)).then((value)=>{
if(value!=null){
if(StringUtils.isEmpty(this.levelHead)){
if(this.userType === "1"){
this.levelHead = value.levelHead
}
}
this.levelId = value.levelId
UserDataLocal.setUserLevel(value.levelId)
UserDataLocal.setUserLevelHeaderUrl(value.levelHead + "")
UserDataLocal.setUserLevel(this.levelId)
UserDataLocal.setUserLevelHeaderUrl(this.levelHead + "")
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
... ...
... ... @@ -108,12 +108,14 @@ export struct SearchComponent {
SearchHistoryComponent({ searchHistoryData: $searchHistoryData, onDelHistory: (): void => this.getSearchHistoryData(),onGetSearchRes: (item,index): void => this.getSearchHistoryResData(item,index) })
}
if(this.searchHistoryData.length>0){
//分隔符
Divider()
.width('100%')
.height('1lpx')
.color($r('app.color.color_EDEDED'))
.strokeWidth('1lpx')
}
SearchHotsComponent({onGetSearchRes: (item): void => this.getSearchHotResData(item)})
}
... ... @@ -123,7 +125,6 @@ export struct SearchComponent {
.width('100%')
.height('100%')
.padding({ left: '31lpx', right: '31lpx' })
.margin({ top: '36lpx' })
} else {
if (this.hasChooseSearch) {
//搜索结果
... ...
... ... @@ -120,7 +120,7 @@ export struct SearchHistoryComponent{
.columnsTemplate('1fr 1fr')
.rowsGap('23lpx')
}
.margin({bottom:'46lpx'})
.margin({top:"36lpx",bottom:'46lpx'})
}
getCategoryRowCount() {
... ...
... ... @@ -41,19 +41,19 @@ export struct SearchHotsComponent{
Text("热门搜索")
.textAlign(TextAlign.Center)
.fontWeight('600lpx')
.fontWeight(FontWeight.Bold)
.fontSize('33lpx')
.lineHeight('46lpx')
.fontColor($r('app.color.color_222222'))
.height('38lpx')
.height('46lpx')
}
.width('100%')
.margin({bottom:"15lpx"})
List(){
ForEach(this.searchHotsData,(item:SearchHotContentItem,index:number)=>{
ListItem(){
Column(){
Column(){
Row(){
Row(){
if(item.sequence <=3){
... ... @@ -80,6 +80,7 @@ export struct SearchHotsComponent{
.fontWeight('400lpx')
.lineHeight('42lpx')
}.layoutWeight(1)
if(item.mark===1 || item.mark===2){
Image(item.mark===1?$r('app.media.search_hots_mark1'):$r('app.media.search_hots_mark2'))
.width('42lpx')
... ... @@ -89,6 +90,7 @@ export struct SearchHotsComponent{
}
}.alignItems(VerticalAlign.Center)
.height('84lpx')
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
if(index != this.searchHotsData.length-1 ){
... ... @@ -98,18 +100,15 @@ export struct SearchHotsComponent{
.color($r('app.color.color_F5F5F5'))
.strokeWidth('1lpx')
}
}.height('108lpx')
.justifyContent(FlexAlign.Center)
}.height('85lpx')
.width('100%')
.alignItems(HorizontalAlign.Start)
.padding({left:'27lpx'})
}
}
.onClick(()=>{
if (this.onGetSearchRes !== undefined) {
this.onGetSearchRes(item.hotEntry)
}
})
.height('117lpx')
})
}.onScrollFrameBegin((offset, state) => {
return { offsetRemain: 0 }
... ...
... ... @@ -20,6 +20,7 @@ struct MineHomePage {
@State userName:string = ""
@State headPhotoUrl:string = ""
@State levelHead:string = ""
userType:string = "1"
@State levelId:number = 0
@State desc:string = "点击添加简介,让大家认识你" //text 搞两个样式,如果三行,就显示 另外一个text 没有显示高度的
@State isHasIntroduction: boolean = false
... ... @@ -31,7 +32,6 @@ struct MineHomePage {
onPageShow(): void {
this.getUserInfo()
this.getUserLevel()
}
build() {
... ... @@ -403,7 +403,20 @@ struct MineHomePage {
this.attentionNum = value.attentionNum
this.registTime = value.registTime
this.getRegisterDays()
this.userType = value.userType
if(this.userType === "1"){
if(StringUtils.isNotEmpty(value.honoraryIcon)){
this.levelHead = value.honoraryIcon
return
}
if(StringUtils.isNotEmpty(value.avatarFrame)){
this.levelHead = value.avatarFrame
}
}
}
this.getUserLevel()
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
})
... ... @@ -411,7 +424,11 @@ struct MineHomePage {
getUserLevel(){
MinePageDatasModel.getUserLevelData(getContext(this)).then((value)=>{
if(value!=null){
if(StringUtils.isEmpty(this.levelHead)){
if(this.userType === "1"){
this.levelHead = value.levelHead
}
}
this.levelId = value.levelId
}
}).catch((err:Error)=>{
... ...
... ... @@ -38,10 +38,10 @@ struct OtherNormalUserHomePage {
@State commentNum:number = 0//评论数
@State attentionNum:number = 0//关注数
@State desc:string = ""
userType:string = "1"
aboutToAppear(){
this.getUserInfo()
this.getUserLevel()
}
... ... @@ -348,7 +348,20 @@ struct OtherNormalUserHomePage {
this.browseNum = StringUtils.isEmpty(value.browseNum)?0:value.browseNum
this.commentNum = StringUtils.isEmpty(value.commentNum)?0:value.commentNum
this.attentionNum = StringUtils.isEmpty(value.attentionNum)?0:value.attentionNum
this.userType = value.userType
if(this.userType === "1"){
if(StringUtils.isNotEmpty(value.honoraryIcon)){
this.levelHead = value.honoraryIcon
return
}
if(StringUtils.isNotEmpty(value.avatarFrame)){
this.levelHead = value.avatarFrame
}
}
}
this.getUserLevel()
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
})
... ... @@ -359,7 +372,11 @@ struct OtherNormalUserHomePage {
}
MinePageDatasModel.getOtherUserLevelData([this.curUserId],getContext(this)).then((value)=>{
if(value!=null){
if(StringUtils.isEmpty(this.levelHead)){
if(this.userType === "1"){
this.levelHead = value[0].levelHead
}
}
this.levelId = value[0].level
}
}).catch((err:Error)=>{
... ...
... ... @@ -9,4 +9,10 @@ export class MineUserDetailItem{
commentNum:number = 0//评论数
attentionNum:number = 0//关注数
registTime:number = 0//账号注册时间
honoraryIcon = ""//荣誉称号 (优先)
avatarFrame:string = ""//最佳评论员头像框地址
}
\ No newline at end of file
... ...