Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
yangchenggong1_wd
2024-04-18 10:52:35 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
aac1a9ea2e56bb510a565d7aa9e57b220040dac4
aac1a9ea
1 parent
229ebc06
desc:搜索跳转 和 登录注销处理
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
80 additions
and
103 deletions
sight_harmony/commons/wdKit/src/main/ets/utils/SPHelper.ets
sight_harmony/commons/wdRouter/src/main/ets/router/WDRouterPage.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/MinePagePersonFunctionUI.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/MinePageUserSimpleInfoUI.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/MinePageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/pages/MineHomePage.ets
sight_harmony/features/wdComponent/src/main/ets/pages/OtherNormalUserHomePage.ets
sight_harmony/features/wdComponent/src/main/ets/pages/SearchCreatorPage.ets
sight_harmony/features/wdComponent/src/main/resources/base/profile/main_pages.json
sight_harmony/commons/wdKit/src/main/ets/utils/SPHelper.ets
View file @
aac1a9e
...
...
@@ -101,4 +101,9 @@ export class SPHelper {
// preferences.clearSync()
// preferences.flush()
// }
public getPreferences(){
let preferences = data_preferences.getPreferences(SPHelper.context, SPHelper.spFilename);
return preferences;
}
}
\ No newline at end of file
...
...
sight_harmony/commons/wdRouter/src/main/ets/router/WDRouterPage.ets
View file @
aac1a9e
...
...
@@ -97,4 +97,6 @@ export class WDRouterPage {
static broadcastPage = new WDRouterPage("phone", "ets/pages/broadcast/BroadcastPage");
//搜索主页
static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage");
//搜索人民号主页
static searchCreatorPage = new WDRouterPage("wdComponent", "ets/pages/SearchCreatorPage");
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/MinePagePersonFunctionUI.ets
View file @
aac1a9e
import { WDRouterRule, WDRouterPage } from 'wdRouter'
import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem'
import router from '@ohos.router'
@Component
export default struct MinePagePersonFunctionUI {
@Link personalData:MinePagePersonalFunctionsItem[]
@Prop isLogin:boolean
@Consume('isLogin')@Watch('loginChange') loginState:Record<string,string>
loginChange(){
if(this.loginState){
this.isLogin=true
}else{
this.isLogin=false
}
}
build() {
Grid(){
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/MinePageUserSimpleInfoUI.ets
View file @
aac1a9e
import { Logger, UserDataLocal } from 'wdKit'
import { Logger,
StringUtils,
UserDataLocal } from 'wdKit'
import { WDRouterPage, WDRouterRule } from 'wdRouter'
import MinePageDatasModel from '../../model/MinePageDatasModel'
const TAG = "MinePageUserSimpleInfoUI"
...
...
@@ -12,20 +12,13 @@ export default struct MinePageUserSimpleInfoUI {
@State levelHead:string = ""
@State levelId:number = 0
@Consume('isLogin') @Watch('loginChange') loginState:Record<string,string>
loginChange(){
Logger.debug("isLogin",'MinePageUserSimpleInfoUI')
if(this.loginState){
this.isLogin=true
}else {
this.isLogin=false
}
}
loginStateChange(){
if(this.isLogin){
this.getUserInfo()
this.getUserLevel()
}else{
this.headPhotoUrl = ""
this.levelHead = ""
}
}
...
...
@@ -33,17 +26,20 @@ export default struct MinePageUserSimpleInfoUI {
Row(){
//头像
Stack(){
Image(this.headPhotoUrl)
Image(this.headPhotoUrl
==""?$r('app.media.default_head'):this.headPhotoUrl
)
.alt($r('app.media.default_head'))
.width('100lpx')
.height('100lpx')
.objectFit(ImageFit.Cover)
.borderRadius(50)
if(StringUtils.isNotEmpty(this.levelHead)){
Image(this.levelHead)
.width('130lpx')
.height('130lpx')
.objectFit(ImageFit.Cover)
.borderRadius(50)
}
}.width('130lpx')
.height('130lpx')
.alignContent(Alignment.Center)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/MinePageComponent.ets
View file @
aac1a9e
...
...
@@ -4,11 +4,10 @@ import MinePageMoreFunctionModel from '../../viewmodel/MinePageMoreFunctionModel
import MinePageDatasModel from '../../model/MinePageDatasModel'
import MinePageUserSimpleInfoUI from '../mine/MinePageUserSimpleInfoUI'
import MinePagePersonFunctionUI from '../mine/MinePagePersonFunctionUI'
import MinePageCardUI from '../mine/MinePageCardUI'
import MinePageCreatorFunctionUI from '../mine/MinePageCreatorFunctionUI'
import MinePageMoreFunctionUI from '../mine/MinePageMoreFunctionUI'
import { SPHelper, StringUtils } from 'wdKit'
import { SpConstants } from 'wdConstant'
import dataPreferences from '@ohos.data.preferences';
const TAG = 'MinePageComponent';
...
...
@@ -24,12 +23,29 @@ export struct MinePageComponent {
@State creatorData:MinePageCreatorFunctionsItem[] = []
@State moreData:MinePageMoreFunctionModel[] = []
scroller: Scroller = new Scroller()
preferences: dataPreferences.Preferences | null = null;
aboutToAppear(){
this.getUserLogin()
this.getFunctionData()
this.addLoginStatusObserver()
}
async addLoginStatusObserver(){
this.preferences = await SPHelper.default.getPreferences();
let observer = (key: string) => {
if(key == SpConstants.USER_ID){
if(StringUtils.isEmpty(SPHelper.default.getSync(SpConstants.USER_ID,""))){
this.isLogin = false
}else {
this.isLogin = true
}
}
}
this.preferences.on('change', observer);
}
getFunctionData(){
//个人功能数据
this.personalData = MinePageDatasModel.getPersonalFunctionsData()
...
...
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
View file @
aac1a9e
...
...
@@ -4,6 +4,7 @@ import { ContentDTO,
import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO'
import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO'
import { LazyDataSource, StringUtils, ToastUtils } from 'wdKit/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem'
import { SearchResultContentData } from '../../viewmodel/SearchResultContentData'
...
...
@@ -20,9 +21,8 @@ export struct SearchResultContentComponent{
@State searchType:string = ""
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
@State data_rmh: SearchRmhDescription[] = []
@State count:number =
0
;
@State count:number =
-1
;
@State isLoading:boolean = false
@State isLoading2:boolean = false
@State hasMore:boolean = true
curPageNum:number = 1;
...
...
@@ -80,6 +80,7 @@ export struct SearchResultContentComponent{
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
this.isLoading = false
this.count = this.count===-1?0:this.count
})
}
}
...
...
@@ -155,7 +156,7 @@ export struct SearchResultContentComponent{
vImageUrl: "",
screenType: "",
source: StringUtils.isEmpty(value.data.creatorName) ? value.data.sourceName : value.data.creatorName,
objectId:
""
,
objectId:
value.data.id
,
objectType: value.data.type,
channelId: value.data.channelId,
relId: value.data.relId,
...
...
@@ -196,6 +197,7 @@ export struct SearchResultContentComponent{
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
this.count = this.count===-1?0:this.count
})
}
...
...
@@ -235,16 +237,24 @@ export struct SearchResultContentComponent{
})
ListItem(){
Column(){
Text("查看更多")
.width('19lpx')
.fontSize('19lpx')
.fontWeight('400lpx')
.lineHeight('27lpx')
.fontColor($r('app.color.color_9E9E9E'))
}.borderRadius({topLeft:'4lpx',bottomLeft:'4lpx'})
.height('180lpx')
.textAlign(TextAlign.Center)
.width('77lpx')
.backgroundColor($r('app.color.color_EDEDED'))
.fontColor($r('app.color.color_9E9E9E'))
.borderRadius({topLeft:'4lpx',bottomLeft:'4lpx'})
.justifyContent(FlexAlign.Center)
}.height('100%')
.margin({left:'23lpx'})
.onClick(()=>{
WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage)
})
}
.cachedCount(6)
.edgeEffect(EdgeEffect.Spring)
...
...
@@ -252,14 +262,6 @@ export struct SearchResultContentComponent{
.listDirection(Axis.Horizontal)
.width('100%')
.height('219lpx')
.onReachEnd(()=>{
if(!this.isLoading2){
this.isLoading2 = true
//进入更多关注页
ToastUtils.shortToast("进入更多关注页")
}
})
Divider()
.width('100%')
...
...
sight_harmony/features/wdComponent/src/main/ets/pages/MineHomePage.ets
View file @
aac1a9e
...
...
@@ -2,7 +2,6 @@ import router from '@ohos.router'
import { Params } from 'wdBean';
import { StringUtils } from 'wdKit';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { CardParser } from '../components/CardParser';
import { HomePageBottomComponent } from '../components/mine/home/HomePageBottomComponent';
import MinePageDatasModel from '../model/MinePageDatasModel';
...
...
@@ -183,37 +182,14 @@ struct MineHomePage {
Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
Column(){
Column() {
// 页签
Row({ space: 7 }) {
Scroll() {
Row() {
this.TabBuilder(0,"评论")
this.TabBuilder(1,"关注")
}
.justifyContent(FlexAlign.Start)
}
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('90%')
.padding({left:'31lpx'})
}
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.alignItems(HorizontalAlign.Start)
.width('100%')
//tab 页面
Tabs({controller: this.controller}) {
TabContent() {
HomePageBottomComponent({style:0})
}
}.tabBar(this.TabBuilder(0,"评论"))
TabContent() {
HomePageBottomComponent({style:1})
}
}.tabBar(this.TabBuilder(1,"关注"))
}
.backgroundColor($r('app.color.white'))
.animationDuration(0)
...
...
@@ -221,8 +197,6 @@ struct MineHomePage {
this.currentIndex = index
})
.vertical(false)
.barHeight(0)
}
}.width("100%")
}
.edgeEffect(EdgeEffect.None)
...
...
@@ -232,8 +206,8 @@ struct MineHomePage {
}
}.width('100%')
.layoutWeight(1)
}
}
@Builder MineHomeTitleTransparent() {
RelativeContainer() {
//标题栏目
...
...
@@ -368,9 +342,9 @@ struct MineHomePage {
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
})
.height('77lpx')
.width('70lpx')
.margin({right:'29lpx'})
.height('100%')
.width('100%')
.margin({right:'9lpx'})
}
/**
...
...
sight_harmony/features/wdComponent/src/main/ets/pages/OtherNormalUserHomePage.ets
View file @
aac1a9e
...
...
@@ -172,42 +172,17 @@ struct OtherNormalUserHomePage {
.width('100%')
.backgroundColor($r('app.color.white'))
}
//间隔符
Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
Column(){
Column() {
// 页签
Row({ space: 7 }) {
Scroll() {
Row() {
this.TabBuilder(0,"评论")
this.TabBuilder(1,"关注")
}
.justifyContent(FlexAlign.Start)
}
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('90%')
.padding({left:'31lpx'})
}
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.backgroundColor($r('app.color.white'))
.alignItems(HorizontalAlign.Start)
.width('100%')
//tab 页面
Tabs({controller: this.controller}) {
TabContent() {
OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum})
}
}.tabBar(this.TabBuilder(0,"评论"))
TabContent() {
OtherHomePageBottomFollowComponent({curUserId:this.curUserId})
}
}.tabBar(this.TabBuilder(1,"关注"))
}
.backgroundColor($r('app.color.white'))
.animationDuration(0)
...
...
@@ -215,8 +190,6 @@ struct OtherNormalUserHomePage {
this.currentIndex = index
})
.vertical(false)
.barHeight(0)
}
}.width("100%")
}
.edgeEffect(EdgeEffect.None)
...
...
@@ -327,9 +300,9 @@ struct OtherNormalUserHomePage {
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
})
.height('77lpx')
.width('70lpx')
.margin({right:'29lpx'})
.height('100%')
.width('100%')
.margin({right:'9lpx'})
}
...
...
sight_harmony/features/wdComponent/src/main/ets/pages/SearchCreatorPage.ets
0 → 100644
View file @
aac1a9e
import { CustomTitleUI } from '../components/reusable/CustomTitleUI';
@Entry
@Component
struct SearchCreatorPage {
build() {
Row() {
Column() {
CustomTitleUI({titleName:"全部结果"})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/resources/base/profile/main_pages.json
View file @
aac1a9e
...
...
@@ -13,6 +13,7 @@
"components/page/BrowsingHistoryPage"
,
"components/page/MyCollectionListPage"
,
"pages/OtherNormalUserHomePage"
,
"pages/SearchPage"
"pages/SearchPage"
,
"pages/SearchCreatorPage"
]
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment