1.2.0部分代码

This commit is contained in:
xiaoxiao
2025-09-09 13:27:34 +08:00
parent e89a5f15ce
commit 3013b441a6
80 changed files with 4824 additions and 105 deletions
@@ -4,9 +4,13 @@ import { TwoSection } from '../view/TwoSection'
import { ThreeSection } from '../view/ThreeSection'
import { FourSection } from '../view/FourSection'
import { OtherList } from '../view/OtherList'
import { HdNav,hdHttp,HdResponse,BasicConstant,ExpertData,authStore,RequestDefaultModel } from '@itcast/basic'
import { HdNav,hdHttp,HdResponse,BasicConstant,ExpertData,authStore,RequestDefaultModel,
ChangeUtil,
logger,
HdLoadingDialog} from '@itcast/basic'
import { BusinessError, emitter } from '@kit.BasicServicesKit';
import HashMap from '@ohos.util.HashMap'
import { router } from '@kit.ArkUI'
interface heroFirst {
id: string;
@@ -18,13 +22,23 @@ export struct MyHomePage {
@State title: string = '我的';
@StorageProp('topHeight')
topHeight: number = 0
@State rightBottom:string = ''
@State rightBottomPath:string = ''
@State rightBottomTitle:string = ''
@State myInfoBackGround:string = '';
@State heroArray:Array<object> = [];
@State expertData:object | string = new Object;
scroller = new Scroller()
dialog: CustomDialogController = new CustomDialogController({
builder: HdLoadingDialog({ message: '加载中...' }),
customStyle: true,
alignment: DialogAlignment.Center
})
aboutToAppear(): void {
this.getAppActivity()
this.uploadBackImgAction();
emitter.on({ eventId: BasicConstant.notification_home_tab_change }, (eventData: emitter.EventData) => {
if (eventData.data?.changeIndex === 2) {
@@ -61,6 +75,25 @@ export struct MyHomePage {
})
}
getAppActivity() {
const hashMap: HashMap<string, string> = new HashMap()
this.dialog.open()
hashMap.clear()
hashMap.set('id','6')
hdHttp.httpReq<string>(BasicConstant.getAppActivity,hashMap).then(async (res: HdResponse<string>) => {
logger.info('Response addBonusPoints'+res)
this.dialog.close()
let json:Record<string,string | Record<string,string>> = JSON.parse(res+'') as Record<string,string | Record<string,string>>
if (json.code == '200') {
this.rightBottom = json.data['img']
this.rightBottomPath = json.data['url_path']
this.rightBottomTitle = json.data['name']
}
}).catch((err: BusinessError) => {
this.dialog.close()
})
}
build() {
Column() {
HdNav({ title: '我的', showLeftIcon:false , showRightIcon: false, hasBorder: true })
@@ -73,6 +106,8 @@ export struct MyHomePage {
Column() {
HeaderView({heroArray:this.heroArray,expertData:this.expertData})
OneSection()
TwoSection()
ThreeSection()
FourSection()
OtherList()
}
@@ -83,6 +118,20 @@ export struct MyHomePage {
.layoutWeight(1)
.scrollBar(BarState.Off)
.align(Alignment.TopStart)
Image(BasicConstant.urlImage+this.rightBottom)
.width(76)
.height(40)
.position({ x: '100%', y: '100%' })
.translate({ x: -76, y: -76 })
.visibility(ChangeUtil.stringIsUndefinedAndNull(this.rightBottom)?Visibility.None:Visibility.Visible)
.onClick(()=>{
router.pushUrl({
url: 'pages/WebView/WebPage',
params: {'title':this.rightBottomTitle,'url':this.rightBottomPath}
})
})
}
.width('100%')
.height('100%')
@@ -1,6 +1,7 @@
import { it } from "@ohos/hypium";
import { MyPageSectionClass } from "../model/MyPageSectionClass";
import { MyPageSectionItem } from '../view/MyPageSectionItem'
import { router } from "@kit.ArkUI";
@Preview
@Component
@@ -9,12 +10,12 @@ export struct ThreeSection {
@State currentIndex: number = 0;
@State threeSectionList:Array<MyPageSectionClass> = [
new MyPageSectionClass('oneItem',$r('app.media.app_icon'),'我的账户','/pages/MyHomePage',false),
new MyPageSectionClass('twoItem',$r('app.media.app_icon'),'我的积分','/pages/MyHomePage',false),
new MyPageSectionClass('threeItem',$r('app.media.app_icon'),'我的福利','/pages/MyHomePage',false),
new MyPageSectionClass('fourItem',$r('app.media.app_icon'),'我的鲜花','/pages/MyHomePage',false),
new MyPageSectionClass('fiveItem',$r('app.media.app_icon'),'课件明细','/pages/MyHomePage',false),
new MyPageSectionClass('fiveItem',$r('app.media.app_icon'),'课程明细','/pages/MyHomePage',false)
// new MyPageSectionClass('oneItem',$r('app.media.app_icon'),'我的账户','/pages/MyHomePage',false),
// new MyPageSectionClass('twoItem',$r('app.media.app_icon'),'我的积分','/pages/MyHomePage',false),
// new MyPageSectionClass('threeItem',$r('app.media.app_icon'),'我的福利','/pages/MyHomePage',false),
new MyPageSectionClass('oneItem',$r('app.media.my_page_myFlower'),'我的鲜花','pages/Flower/FlowerDetailsPage',false),
new MyPageSectionClass('twoItem',$r("app.media.my_page_coursewareDetails"),'课件明细','/pages/MyHomePage',false),
// new MyPageSectionClass('fiveItem',$r('app.media.app_icon'),'课程明细','/pages/MyHomePage',false)
];
private getPagedItems(): Array<Array<MyPageSectionClass>> {
@@ -43,6 +44,11 @@ export struct ThreeSection {
ForEach(pageItems, (item: MyPageSectionClass) => {
GridItem() {
MyPageSectionItem({ sectionItem: item })
.onClick(()=>{
router.pushUrl({
url:item.path
})
})
}
}, (item: MyPageSectionClass) => item.id)
}
@@ -1,6 +1,7 @@
import { it } from "@ohos/hypium";
import { MyPageSectionClass } from "../model/MyPageSectionClass";
import { MyPageSectionItem } from '../view/MyPageSectionItem'
import { router } from "@kit.ArkUI";
@Preview
@Component
@@ -9,10 +10,10 @@ export struct TwoSection {
@State currentIndex: number = 0;
@State twoSectionList:Array<MyPageSectionClass> = [
new MyPageSectionClass('oneItem',$r('app.media.app_icon'),'我的视频','/pages/MyHomePage',false),
new MyPageSectionClass('twoItem',$r('app.media.app_icon'),'我的课程','/pages/MyHomePage',false),
new MyPageSectionClass('threeItem',$r('app.media.app_icon'),'我的下载','/pages/MyHomePage',false),
new MyPageSectionClass('fourItem',$r('app.media.app_icon'),'我的收藏','/pages/MyHomePage',false)
// new MyPageSectionClass('oneItem',$r('app.media.app_icon'),'我的视频','pages/MyHomePage',false),
// new MyPageSectionClass('twoItem',$r('app.media.app_icon'),'我的课程','pages/MyHomePage',false),
new MyPageSectionClass('oneItem',$r('app.media.my_page_download'),'我的下载','pages/Download/AllDownloadPage',false),
// new MyPageSectionClass('fourItem',$r('app.media.app_icon'),'我的收藏','pages/MyHomePage',false)
];
private getPagedItems(): Array<Array<MyPageSectionClass>> {
@@ -41,6 +42,11 @@ export struct TwoSection {
ForEach(pageItems, (item: MyPageSectionClass) => {
GridItem() {
MyPageSectionItem({ sectionItem: item })
.onClick(()=>{
router.pushUrl({
url:item.path
})
})
}
}, (item: MyPageSectionClass) => item.id)
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB