From e794ed885a75be8ab5c789c2ea8db902ce338b0b Mon Sep 17 00:00:00 2001 From: wwf <1971391498@qq.com> Date: 星期三, 08 十月 2025 00:01:17 +0800 Subject: [PATCH] 完善功能 --- entry/src/main/ets/pages/home/ClassificationDetail.ets | 54 ++++ entry/src/main/ets/pages/search/SearchPage.ets | 237 ++++++++++++----- entry/src/main/ets/pages/MainPage.ets | 16 entry/src/main/resources/base/media/search_icon.png | 0 entry/src/main/resources/base/media/left_icon.png | 0 entry/src/main/resources/base/media/up_icon.png | 0 entry/src/main/resources/base/profile/main_pages.json | 7 entry/src/main/ets/pages/home/BannerDetail.ets | 62 ++++ entry/src/main/resources/base/media/person_icon.png | 0 entry/src/main/ets/pages/home/ActiveDetail.ets | 106 ++++++++ entry/src/main/resources/base/media/video_icon.png | 0 oh-package-lock.json5 | 4 entry/src/main/ets/pages/home/Home.ets | 144 ++++++++++ entry/src/main/resources/base/media/company_icon.png | 0 entry/src/main/ets/pages/message/MessagePage.ets | 114 ++----- entry/src/main/resources/base/media/down_icon.png | 0 16 files changed, 581 insertions(+), 163 deletions(-) diff --git a/entry/src/main/ets/pages/MainPage.ets b/entry/src/main/ets/pages/MainPage.ets index a55e4b1..23d8e66 100644 --- a/entry/src/main/ets/pages/MainPage.ets +++ b/entry/src/main/ets/pages/MainPage.ets @@ -1,4 +1,6 @@ import { Home } from './home/Home' +import { MessagePage } from './message/MessagePage' +import { SearchPage } from './search/SearchPage' /** * @Description : 搴曢儴瀵艰埅锛孉PP妯″潡 @@ -17,7 +19,7 @@ { icon: 'tabs_message_icon', title: '娑堟伅' }, { icon: 'tabs_account_icon', title: '鎴戠殑' } ] - @State selectIndex: number = 0 + @State selectIndex: number = 2 private tabController: TabsController = new TabsController() @Builder tabItem(icon: ResourceStr,title: string,index: number){ @@ -39,18 +41,16 @@ Tabs({barPosition: BarPosition.End,controller: this.tabController}){ ForEach(this.tabBarList,(item: TabBarBase,index:number) => { TabContent(){ - if (index === 0) { + if (this.selectIndex == 0) { Home() - } else if (index === 1){ - // SearchPage() - } else if (index === 2){ - // MessagePage() + } else if (this.selectIndex == 1){ + SearchPage() + } else if (this.selectIndex == 2){ + MessagePage() } else if (index === 3){ // AccountPage() } } - //璋冪敤鑷畾涔夌殑鏍峰紡 - // .tabBar(this.tabItem(item.icon,item.title,index)) }) } .barHeight(0) diff --git a/entry/src/main/ets/pages/home/ActiveDetail.ets b/entry/src/main/ets/pages/home/ActiveDetail.ets new file mode 100644 index 0000000..1865836 --- /dev/null +++ b/entry/src/main/ets/pages/home/ActiveDetail.ets @@ -0,0 +1,106 @@ +import { router } from "@kit.ArkUI" + +@Entry +@Component +export struct ActiveDetail { + @State index: number = 0 + aboutToAppear(): void { + interface Params { + index: number + } + const params: Params = router.getParams() as Params + this.index = params.index + } + + + getTagFontColor(statusText: string) { + switch (statusText) { + case '鎶ュ悕涓�': + return '#10920e' + case '杩涜涓�': + return '#ffa100' + default : + return '#666666' + } + } + + getTagBgColor(statusText: string) { + switch (statusText) { + case '鎶ュ悕涓�': + return '#d5f2db' + case '杩涜涓�': + return '#fff0cc' + default : + return '#ebebeb' + } + } + + build() { + Column() { + Row() { + Image($r('app.media.left_icon')) + .width(20) + .height(20) + Text('璇︽儏椤�') + .fontSize(18) + .fontWeight(700) + Row() + } + .width('100%') + .padding(10) + .justifyContent(FlexAlign.SpaceBetween) + + Image($r('app.media.image1')) + .width('100%') + .height(150) + + Column({ space: 14 }) { + Text('鍖椾含浜哄伐鏅鸿兘IE') + .fontWeight(800) + .width('100%') + + Row({ space: 10 }) { + Text('鎶ュ悕涓�') + .fontSize(10) + .fontWeight(500) + .padding({ left: 4, right: 4, top: 2, bottom: 2 }) + .borderRadius(10) + .fontColor(this.getTagFontColor('鎶ュ悕涓�')) + .backgroundColor(this.getTagBgColor('鎶ュ悕涓�')) + Row() { + Image($r('app.media.date_icon')) + .width(12) + .height(12) + Text('20250520-20250620') + .fontSize(10) + .fontColor('#676767') + .margin({ left: 4 }) + } + Text(`80浜哄凡鎶ュ悕`) + .fontSize(10) + .fontColor('#676767') + } + .width('100%') + .justifyContent(FlexAlign.Start) + + Text('璇剧▼浠嬬粛') + .width('100%') + .fontSize(14) + .fontWeight(800) + + Text('鏈绋嬫槸璁$畻鏈虹綉缁滄妧鏈�侀�氫俊鎶�鏈瓑涓撲笟鐨勪笓涓氭牳蹇冭绋嬶紝鏃ㄥ湪鍩瑰吇瀛︾敓鐨勭綉缁滄妧鏈亴涓氳兘鍔涖�佽亴涓氱礌鍏诲拰鍒涙柊鑳藉姏銆�' + + '\n閲囩敤椤圭洰寮忓疄璁暀瀛︼紝閫氳繃寮曞叆涓�涓惊搴忔笎杩涚殑浼佷笟缃戠粶缁勫缓妗堜緥锛岃瀛︾敓鍦ㄦā鎷熺湡瀹炲満鏅腑鎺屾彙涓皬鍨嬩紒涓氱綉缁滅粍寤虹殑鐭ヨ瘑鍜岃兘鍔�' + + '鏁欐潗鍐呭瑕嗙洊鍗庝负鈥�1+X鈥濊瘉涔﹁�冭瘯瑕佹眰锛屽寘鍚ぇ閲忓疄鎿嶇粌涔犮��') + .width('100%') + .fontSize(13) + .lineHeight(20) + } + .padding(14) + + + + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/home/BannerDetail.ets b/entry/src/main/ets/pages/home/BannerDetail.ets new file mode 100644 index 0000000..8b2a858 --- /dev/null +++ b/entry/src/main/ets/pages/home/BannerDetail.ets @@ -0,0 +1,62 @@ +import { router } from "@kit.ArkUI"; + +@Entry +@Component +export struct BannerDetail { + @State index: number = 0; + aboutToAppear(): void { + interface Params { + index: number + } + const params: Params = router.getParams() as Params + if (params) { + this.index = params.index + } + } + + build() { + Column() { + Row() { + Image($r('app.media.left_icon')) + .width(20) + .height(20) + Text('璇︽儏椤�') + .fontSize(18) + .fontWeight(700) + Row() + } + .width('100%') + .padding(10) + .justifyContent(FlexAlign.SpaceBetween) + + Image($r('app.media.image1')) + .width('100%') + .height(150) + + Column({ space: 10 }) { + Text('鍗庝负[1+X]銆婄綉缁滅郴缁熷缓璁句笌杩愮淮銆�') + .fontWeight(800) + .width('100%') + + Text('璇剧▼浠嬬粛') + .width('100%') + .fontSize(14) + .fontWeight(800) + .margin({ top: 10 }) + + Text('鏈绋嬫槸璁$畻鏈虹綉缁滄妧鏈�侀�氫俊鎶�鏈瓑涓撲笟鐨勪笓涓氭牳蹇冭绋嬶紝鏃ㄥ湪鍩瑰吇瀛︾敓鐨勭綉缁滄妧鏈亴涓氳兘鍔涖�佽亴涓氱礌鍏诲拰鍒涙柊鑳藉姏銆�' + + '\n閲囩敤椤圭洰寮忓疄璁暀瀛︼紝閫氳繃寮曞叆涓�涓惊搴忔笎杩涚殑浼佷笟缃戠粶缁勫缓妗堜緥锛岃瀛︾敓鍦ㄦā鎷熺湡瀹炲満鏅腑鎺屾彙涓皬鍨嬩紒涓氱綉缁滅粍寤虹殑鐭ヨ瘑鍜岃兘鍔�' + + '鏁欐潗鍐呭瑕嗙洊鍗庝负鈥�1+X鈥濊瘉涔﹁�冭瘯瑕佹眰锛屽寘鍚ぇ閲忓疄鎿嶇粌涔犮��') + .width('100%') + .fontSize(13) + .lineHeight(20) + } + .padding(14) + + + + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/home/ClassificationDetail.ets b/entry/src/main/ets/pages/home/ClassificationDetail.ets new file mode 100644 index 0000000..411f606 --- /dev/null +++ b/entry/src/main/ets/pages/home/ClassificationDetail.ets @@ -0,0 +1,54 @@ +import { router } from "@kit.ArkUI" + +@Entry +@Component +export struct ClassificationDetail { + @State title: string = '' + aboutToAppear(): void { + interface Params { + title: string + } + const params = router.getParams() as Params + this.title = params.title + } + + build() { + Column() { + Row() { + Image($r('app.media.left_icon')) + .width(20) + .height(20) + Text('璇︽儏椤�') + .fontSize(18) + .fontWeight(700) + Row() + } + .width('100%') + .padding(10) + .justifyContent(FlexAlign.SpaceBetween) + + Image($r('app.media.image1')) + .width('100%') + .height(180) + + Column({ space: 10 }) { + + Text('璇︽儏浠嬬粛') + .width('100%') + .fontSize(14) + .fontWeight(800) + .margin({ top: 10 }) + + Text('鏈绋嬫槸璁$畻鏈虹綉缁滄妧鏈�侀�氫俊鎶�鏈瓑涓撲笟鐨勪笓涓氭牳蹇冭绋嬶紝鏃ㄥ湪鍩瑰吇瀛︾敓鐨勭綉缁滄妧鏈亴涓氳兘鍔涖�佽亴涓氱礌鍏诲拰鍒涙柊鑳藉姏銆�' + + '\n閲囩敤椤圭洰寮忓疄璁暀瀛︼紝閫氳繃寮曞叆涓�涓惊搴忔笎杩涚殑浼佷笟缃戠粶缁勫缓妗堜緥锛岃瀛︾敓鍦ㄦā鎷熺湡瀹炲満鏅腑鎺屾彙涓皬鍨嬩紒涓氱綉缁滅粍寤虹殑鐭ヨ瘑鍜岃兘鍔�' + + '鏁欐潗鍐呭瑕嗙洊鍗庝负鈥�1+X鈥濊瘉涔﹁�冭瘯瑕佹眰锛屽寘鍚ぇ閲忓疄鎿嶇粌涔犮��') + .width('100%') + .fontSize(13) + .lineHeight(20) + } + .padding(14) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/home/Home.ets b/entry/src/main/ets/pages/home/Home.ets index 4f6cbe7..47cf6dd 100644 --- a/entry/src/main/ets/pages/home/Home.ets +++ b/entry/src/main/ets/pages/home/Home.ets @@ -1,3 +1,5 @@ +import { router } from "@kit.ArkUI" + class TabBarBase { title: string = '' } @@ -11,11 +13,19 @@ signupCount: number = 0 statusText: string = '' } +class Course { + title: string = '' + desc: string = '' + count: string = '' + time: string = '' + difficult: string = '' +} + @Entry @Component export struct Home { @State pageHeight: number = 0 - @State activeIndex:number = 0 + @State activeIndex:number = 1 @State tabList: TabBarBase[] = [ { title: '棣栭〉' }, { title: '璇剧▼' } @@ -46,6 +56,25 @@ { title: '鍖椾含浜哄伐鏅鸿兘IE', timeScope: '20250520-20250620', signupCount: 80, statusText: '宸茬粨鏉�' }, { title: '鍖椾含浜哄伐鏅鸿兘IE', timeScope: '20250520-20250620', signupCount: 80, statusText: '鎶ュ悕涓�' }, { title: '鍖椾含浜哄伐鏅鸿兘IE', timeScope: '20250520-20250620', signupCount: 80, statusText: '宸茬粨鏉�' }, + ] + @State courseList: Course[] = [ + { title: '闆跺熀纭�鍒颁紒涓氱骇椤圭洰瀹炴垬', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, + { title: '闆跺熀纭�鍒颁紒涓氱骇椤圭洰瀹炴垬', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, + { title: 'Java楂樼骇锛欽VM娣卞害璋冧紭涓嶫VM娣卞害璋冧紭', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, + { title: '闆跺熀纭�鍒颁紒涓氱骇椤圭洰瀹炴垬', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, + { title: '闆跺熀纭�鍒颁紒涓氱骇椤圭洰瀹炴垬', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, + { title: '闆跺熀纭�鍒颁紒涓氱骇椤圭洰瀹炴垬', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, + { title: '闆跺熀纭�鍒颁紒涓氱骇椤圭洰瀹炴垬', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, + { title: '闆跺熀纭�鍒颁紒涓氱骇椤圭洰瀹炴垬', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, + { title: '闆跺熀纭�鍒颁紒涓氱骇椤圭洰瀹炴垬', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, + { title: '闆跺熀纭�鍒颁紒涓氱骇椤圭洰瀹炴垬', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, + { title: '闆跺熀纭�鍒颁紒涓氱骇椤圭洰瀹炴垬', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, + { title: '闆跺熀纭�鍒颁紒涓氱骇椤圭洰瀹炴垬', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, + { title: '闆跺熀纭�鍒颁紒涓氱骇椤圭洰瀹炴垬', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, + { title: '闆跺熀纭�鍒颁紒涓氱骇椤圭洰瀹炴垬', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, + { title: '闆跺熀纭�鍒颁紒涓氱骇椤圭洰瀹炴垬', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, + { title: '闆跺熀纭�鍒颁紒涓氱骇椤圭洰瀹炴垬', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, + ] @Builder tabBarItem(name:string,index: number){ @@ -94,7 +123,7 @@ Tabs({controller:this.tabController}){ ForEach(this.tabList, (item: TabBarBase, index: number) => { // 棣栭〉 ------------ - if (item.title == '棣栭〉') { + if (this.activeIndex == 0) { TabContent() { Column({ space: 10 }){ Swiper() { @@ -103,6 +132,14 @@ .width('100%') .height(120) .backgroundColor(0xAFEEEE) + .onClick(() => { + this.getUIContext().getRouter().pushUrl({ + url: 'pages/home/BannerDetail', + params: { + id: index + } + }) + }) }) } .borderRadius(10) @@ -131,6 +168,14 @@ .fontSize(12) .fontWeight(500) } + .onClick(() => { + router.pushUrl({ + url: 'pages/home/ClassificationDetail', + params: { + title: item.title + } + }) + }) } }) } @@ -191,6 +236,14 @@ .height(100) .padding(10) .justifyContent(FlexAlign.SpaceBetween) + .onClick(() => { + router.pushUrl({ + url: 'pages/home/ActiveDetail', + params: { + index: index + } + }) + }) } }, (index: number) => index.toString()) } @@ -209,10 +262,93 @@ } // 璇剧▼------------ - if (item.title == '璇剧▼') { + if (this.activeIndex == 1) { TabContent() { - Text('璇剧▼content') + Column({ space: 10 }) { + Row() { + Image($r('app.media.search_icon')) + .width(14) + .height(14) + TextInput({ placeholder: '鎼滅储鎯宠鏌ユ壘鐨勫唴瀹�' }) + .placeholderFont({ size: 14}) + .placeholderColor('#999999') + .backgroundColor('#f3f7fe') + } + .borderRadius(30) + .padding({ left: 20, right: 20 }) + .backgroundColor('#f3f7fe') + .width('100%') + List({ space: 10, initialIndex: 0 }) { + ForEach(this.courseList, (item: Course, index: number) => { + ListItem() { + Row({ space: 10 }) { + Column() { + Text(item.title) + .fontSize(14) + .fontWeight(800) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + Text(item.desc) + .fontSize(12) + .fontColor('#666666') + .maxLines(2) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + Row() { + Row({ space: 2 }) { + Image($r('app.media.person_icon')) + .width(10) + .height(10) + Text(item.count) + .fontSize(10) + .fontColor('#666666') + } + Row({ space: 2 }) { + Image($r('app.media.video_icon')) + .width(10) + .height(10) + Text(item.time) + .fontSize(10) + .fontColor('#666666') + } + Text() { + Span('璇剧▼闅惧害: ') + Span(item.difficult) + } + .fontSize(10) + .fontColor('#666666') + } + .width('100%') + .justifyContent(FlexAlign.SpaceBetween) + } + .layoutWeight(0) + .width(170) + .height('100%') + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(HorizontalAlign.Start) + Image($r('app.media.active_list_img')) + .aspectRatio(16/9) + .height('100%') + .layoutWeight(1) + } + .width('100%') + .height(100) + .padding(10) + .justifyContent(FlexAlign.SpaceBetween) + .border({ width: 1, style: BorderStyle.Solid, color: '#f2f2f2' }) + .borderRadius(10) + } + }, (index: number) => index.toString()) + } + .listDirection(Axis.Vertical) // 鎺掑垪鏂瑰悜 + .scrollBar(BarState.Off) + .friction(0.6) + .edgeEffect(EdgeEffect.Spring) + .width('100%') + .height(530) + + } + .height('100%') }.tabBar(this.tabBarItem(item.title, index)) } }) diff --git a/entry/src/main/ets/pages/message/MessagePage.ets b/entry/src/main/ets/pages/message/MessagePage.ets index af21043..e25fdab 100644 --- a/entry/src/main/ets/pages/message/MessagePage.ets +++ b/entry/src/main/ets/pages/message/MessagePage.ets @@ -1,63 +1,49 @@ -import { CommonConstantWX } from "../../common/CommonConstantWX" -import { WxUserInfoBase } from "../../data/WxUserInfoBase" -/* - * Search({placeholder: '璇疯緭鍏ユ偍瑕佹悳绱㈢殑鍐呭',value: 'DeepSeek'}) - .width('90%') - .backgroundColor(Color.White) - .searchButton('鎼滅储') - .onChange((value: string) => { - console.info(`杈撳叆鐨勫唴瀹逛负锛�${value}`) - }) - //鎻愪氦鏂规硶 - .onSubmit((value:string) => { - console.info(`鎻愪氦鐨勫唴瀹逛负锛�${value}`) - }) - * */ +class Message { + avatar: string | Resource = '' + name: string = '' + company: string = '' + desc: string = '' +} + @Entry @Component export struct MessagePage { - @State userList:Array<WxUserInfoBase> = CommonConstantWX.mUser - @State searchUser:Array<WxUserInfoBase> = [] + @State messageList: Message[] = [ + { avatar: '', name: '鏉庡コ澹�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...' }, + { avatar: '', name: '鏋楀厛鐢�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...' }, + { avatar: '', name: '鍚村コ澹�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...' } + ] + build() { Column({space: 10}) { - Search({placeholder: '鎼滅储'}) - .backgroundColor(Color.White) - .width('90%') - .borderRadius(5) - .onChange((value: string) =>{ - //姣忔杈撳叆閮借娓呯┖searchUser鏁扮粍 - this.searchUser = [] - let searchCount = 0 - //杩涜閬嶅巻锛屽湪鏁扮粍婧愬ご鏌ユ壘鍜寁alue鐩稿叧鐨勬暟鎹� - for (let index = 0; index < this.userList.length; index++) { - const element = this.userList[index]; - //鍒ゆ柇姣忎竴鏉℃暟鎹槸鍚︽湁鍜孷alue鐩稿叧鐨勫唴瀹� - if (element.name?.indexOf(value) != -1) { - //鎵惧埌鐩稿叧鐨勬暟鎹紝娣诲姞鍒皊earch鏁扮粍褰撲腑锛屽苟涓旀暟鎹姞涓� - searchCount ++ - this.searchUser.push(element) - } - } - //鍒ゆ柇SearchCount鏄惁涓�0 - if (searchCount === 0) { - //琛ㄧず鏌ユ棤姝や汉 - this.searchUser.push({ - id: 999, - name: '鏃犳鐢ㄦ埛', - img:$r('app.media.avatar_icon') - }) - } + Text('鑱旂郴浜�') + .width('100%') + .textAlign(TextAlign.Start) + .fontWeight(800) + .fontSize(18) + .margin({ left: 16 }) + Row() { + Image($r('app.media.search_icon')) + .width(14) + .height(14) + TextInput({ placeholder: '鎼滅储鎯宠鏌ユ壘鐨勫矖浣�' }) + .placeholderFont({ size: 14}) + .placeholderColor('#999999') + .backgroundColor('#f3f7fe') + } + .borderRadius(30) + .padding({ left: 20, right: 20 }) + .backgroundColor('#f3f7fe') + .width('100%') + .margin({ top: 10 }) + + List({ space: 10, initialIndex: 0 }){ + ForEach(this.messageList, (item: Message) => { }) - List({space: 20}){ - ForEach(this.searchUser.length === 0 ? this.userList: this.searchUser,(item: WxUserInfoBase) => { - ListItem(){ - userInfoItem({item: item}) - } - }) } - .height('90%') + .height('100%') .padding({top:10}) .margin({bottom: 30}) .backgroundColor(Color.White) @@ -65,30 +51,6 @@ } .height('100%') .width('100%') - .backgroundColor('#ccc') - } -} - -@Component -struct userInfoItem { - @Prop item: WxUserInfoBase - build() { - Row({space: 15}){ - Image(this.item.img) - .width(40) - .height(40) - .objectFit(ImageFit.Cover) - Text(this.item.name) - .fontSize(20) - } - .onClick(() => { - this.getUIContext().getRouter().pushUrl({ - url: 'pages/message/MessageDetailsPage', - params:{ - userInfo: this.item - } - }) - }) - .padding(10) + .padding({ left: 10, right: 10 }) } } \ No newline at end of file diff --git a/entry/src/main/ets/pages/search/SearchPage.ets b/entry/src/main/ets/pages/search/SearchPage.ets index 408cf26..6ceb8d4 100644 --- a/entry/src/main/ets/pages/search/SearchPage.ets +++ b/entry/src/main/ets/pages/search/SearchPage.ets @@ -1,82 +1,175 @@ -import { AxiosResponse } from "@ohos/axios" -import { NewsBase, NewsBaseData } from "../../data/NewsBase" -import { TextBase } from "../../data/TextBase" -import { NewsApi, TextApi } from "../../http/AxiosAPI" +import { IconType } from "@kit.ArkUI" + +class JobItem { + title: string = '' + payment: string = '' + tagList: string[] = [] + company: string = '' + address: string = '' + detail: string = '' +} @Entry @Component export struct SearchPage { - //鍙橀噺鎵胯浇鏂伴椈鏁版嵁 - @State newsBase: NewsBase = new NewsBase() - @State TextData: TextBase = new TextBase() - async aboutToAppear() { - let newsData:NewsBase = await NewsApi() - this.newsBase = newsData - let textData:TextBase = await TextApi() - this.TextData = textData - console.info('textData ' + JSON.stringify(textData)) - } - build() { - Column() { - Column(){ - Text(JSON.stringify(this.TextData.text)) - .fontWeight(700) - .fontSize(20) + @State jobList: JobItem[] = [ + { title: '楂樼骇鍓嶇寮�鍙戝伐绋嬪笀锛圴ue3+TS鏂瑰悜锛�', payment: '25k-40k 路 14钖�', tagList: ['1-3骞�', '鏈鍙婁互涓�'], company: '浜戣垝鎶�鏈湁闄愬叕鍙�', address: '娣卞湷甯� 鍗楀北鍖� 铔囧彛', detail: '' }, + { title: '楂樼骇鍓嶇寮�鍙戝伐绋嬪笀锛圴ue3+TS鏂瑰悜锛�', payment: '25k-40k 路 14钖�', tagList: ['1-3骞�', '鏈鍙婁互涓�'], company: '浜戣垝鎶�鏈湁闄愬叕鍙�', address: '娣卞湷甯� 鍗楀北鍖� 铔囧彛', detail: '' }, + { title: '楂樼骇鍓嶇寮�鍙戝伐绋嬪笀锛圴ue3+TS鏂瑰悜锛�', payment: '25k 路 14钖�', tagList: ['1-3骞�', '鏈鍙婁互涓�'], company: '浜戣垝鎶�鏈湁闄愬叕鍙�', address: '娣卞湷甯� 鍗楀北鍖� 铔囧彛', detail: '' }, + { title: '楂樼骇鍓嶇寮�鍙戝伐绋嬪笀锛圴ue3+TS鏂瑰悜锛�', payment: '25k 路 14钖�', tagList: ['1-3骞�', '鏈鍙婁互涓�'], company: '浜戣垝鎶�鏈湁闄愬叕鍙�', address: '娣卞湷甯� 鍗楀北鍖� 铔囧彛', detail: '' }, + { title: '楂樼骇鍓嶇寮�鍙戝伐绋嬪笀锛圴ue3+TS鏂瑰悜锛�', payment: '25k 路 14钖�', tagList: ['1-3骞�', '鏈鍙婁互涓�'], company: '浜戣垝鎶�鏈湁闄愬叕鍙�', address: '娣卞湷甯� 鍗楀北鍖� 铔囧彛', detail: '' }, + { title: '楂樼骇鍓嶇寮�鍙戝伐绋嬪笀锛圴ue3+TS鏂瑰悜锛�', payment: '25k 路 14钖�', tagList: ['1-3骞�', '鏈鍙婁互涓�'], company: '浜戣垝鎶�鏈湁闄愬叕鍙�', address: '娣卞湷甯� 鍗楀北鍖� 铔囧彛', detail: '' }, + { title: '楂樼骇鍓嶇寮�鍙戝伐绋嬪笀锛圴ue3+TS鏂瑰悜锛�', payment: '25k 路 14钖�', tagList: ['1-3骞�', '鏈鍙婁互涓�'], company: '浜戣垝鎶�鏈湁闄愬叕鍙�', address: '娣卞湷甯� 鍗楀北鍖� 铔囧彛', detail: '' }, + { title: '楂樼骇鍓嶇寮�鍙戝伐绋嬪笀锛圴ue3+TS鏂瑰悜锛�', payment: '25k 路 14钖�', tagList: ['1-3骞�', '鏈鍙婁互涓�'], company: '浜戣垝鎶�鏈湁闄愬叕鍙�', address: '娣卞湷甯� 鍗楀北鍖� 铔囧彛', detail: '' }, + { title: '楂樼骇鍓嶇寮�鍙戝伐绋嬪笀锛圴ue3+TS鏂瑰悜锛�', payment: '25k 路 14钖�', tagList: ['1-3骞�', '鏈鍙婁互涓�'], company: '浜戣垝鎶�鏈湁闄愬叕鍙�', address: '娣卞湷甯� 鍗楀北鍖� 铔囧彛', detail: '' }, + { title: '楂樼骇鍓嶇寮�鍙戝伐绋嬪笀锛圴ue3+TS鏂瑰悜锛�', payment: '25k 路 14钖�', tagList: ['1-3骞�', '鏈鍙婁互涓�'], company: '浜戣垝鎶�鏈湁闄愬叕鍙�', address: '娣卞湷甯� 鍗楀北鍖� 铔囧彛', detail: '' }, + { title: '楂樼骇鍓嶇寮�鍙戝伐绋嬪笀锛圴ue3+TS鏂瑰悜锛�', payment: '25k 路 14钖�', tagList: ['1-3骞�', '鏈鍙婁互涓�'], company: '浜戣垝鎶�鏈湁闄愬叕鍙�', address: '娣卞湷甯� 鍗楀北鍖� 铔囧彛', detail: '' }, + { title: '楂樼骇鍓嶇寮�鍙戝伐绋嬪笀锛圴ue3+TS鏂瑰悜锛�', payment: '25k 路 14钖�', tagList: ['1-3骞�', '鏈鍙婁互涓�'], company: '浜戣垝鎶�鏈湁闄愬叕鍙�', address: '娣卞湷甯� 鍗楀北鍖� 铔囧彛', detail: '' }, + { title: '楂樼骇鍓嶇寮�鍙戝伐绋嬪笀锛圴ue3+TS鏂瑰悜锛�', payment: '25k 路 14钖�', tagList: ['1-3骞�', '鏈鍙婁互涓�'], company: '浜戣垝鎶�鏈湁闄愬叕鍙�', address: '娣卞湷甯� 鍗楀北鍖� 铔囧彛', detail: '' }, + ] + @State expandIndex: number | null = 0 - } - .width('95%') - .height(50) - .borderRadius(20) - .backgroundColor(Color.White) - .justifyContent(FlexAlign.Center) - .onClick(() => { - console.info('TextData: ' + JSON.stringify(this.TextData.text)) - }) - List({space:15}){ - ForEach(this.newsBase.data,(item:NewsBaseData) =>{ - ListItem(){ - newsItem({newsData: item}) - } - }) - } - .alignListItem(ListItemAlign.Center) - } - .height('100%') - .width('100%') - .backgroundColor("#ffececec") - } -} -//鏉$洰鏍峰紡锛岃嚜瀹氫箟缁勪欢 -@Component -struct newsItem { - @Prop newsData: NewsBaseData build() { - Row({space: 10}){ - Image(this.newsData.pic) - //鍗犱綅鍥� - .alt($r('app.media.app_logo_image')) - .width(100) - .height(70) - .objectFit(ImageFit.Fill) - Column({space: 10}){ - Text(this.newsData.title).SearchTextSty(18,700) - Text(this.newsData.desc).SearchTextSty(15,400,Color.Black,2) - Text(`鐑害锛� ${this.newsData.hot}`).SearchTextSty(10,400,Color.Red) - .textAlign(TextAlign.End) + Column({ space: 10 }) { + Text('宀椾綅鎺ㄨ崘') + .width('100%') + .textAlign(TextAlign.Start) + .fontWeight(800) + .fontSize(18) + .margin({ left: 16 }) + + Row() { + Image($r('app.media.search_icon')) + .width(14) + .height(14) + TextInput({ placeholder: '鎼滅储鎯宠鏌ユ壘鐨勫矖浣�' }) + .placeholderFont({ size: 14}) + .placeholderColor('#999999') + .backgroundColor('#f3f7fe') } - .width('65%') + .borderRadius(30) + .padding({ left: 20, right: 20 }) + .backgroundColor('#f3f7fe') + .width('100%') + .margin({ top: 10 }) + + List({ space: 10, initialIndex: 0 }) { + ForEach(this.jobList, (item: JobItem, index: number) => { + ListItem() { + Column() { + Row({ space: 10 }) { + Column() { + Text(item.title) + .fontSize(14) + .fontWeight(800) + Row({ space: 10 }) { + ForEach(item.tagList, (tag: string) => { + Text(tag) + .padding(4) + .borderRadius(4) + .fontSize(10) + .fontColor('#999999') + .backgroundColor('#f5f5f5') + }) + } + .width('100%') + .justifyContent(FlexAlign.Start) + + Row({ space: 8 }) { + Image($r('app.media.company_icon')) + .width(16) + .height(16) + + Text(item.company) + .fontSize(10) + + } + } + .layoutWeight(0) + .width(200) + .height('100%') + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(HorizontalAlign.Start) + + Column() { + Text(item.payment) + .fontColor('#1756f4') + .fontSize(14) + .fontWeight(800) + Text(item.address) + .fontColor('#a6a6a6') + .fontSize(10) + } + .height('100%') + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(HorizontalAlign.End) + } + .width('100%') + .height(100) + .justifyContent(FlexAlign.SpaceBetween) + + + Row() { + Text() { + Span(this.expandIndex == index ? '鏀惰捣' : '灞曞紑') + Span('宀椾綅瑕佹眰') + } + .fontSize(10) + .fontColor('#666666') + Image(this.expandIndex == index ? $r('app.media.down_icon') : $r('app.media.up_icon')) + .width(14) + .height(14) + .margin({ left: 4 }) + } + .height(20) + .margin({ top: 10 }) + .alignItems(VerticalAlign.Center) + .onClick(() => { + if (this.expandIndex == index) { + this.expandIndex = null + } else { + this.expandIndex = index + } + }) + + if (this.expandIndex == index) { + Divider() + .color('#f0f0f0') + .margin({ top: 5, bottom: 5 }) + + Text('宀椾綅瑕佹眰:') + .fontSize(13) + .fontWeight(500) + .margin({ top: 10 }) + .width('100%') + .textAlign(TextAlign.Start) + Text('1.瀛﹀巻瑕佹眰锛氭湰绉戝強浠ヤ笂瀛﹀巻锛岃绠楁満绉戝涓庢妧鏈�佽蒋浠跺伐绋嬬瓑鐩稿叧涓撲笟浼樺厛锛屼紭绉�澶т笓瀛﹀巻鑰�' + + '1.瀛﹀巻瑕佹眰锛氭湰绉戝強浠ヤ笂瀛﹀巻锛岃绠楁満绉戝涓庢妧鏈�佽蒋浠跺伐绋嬬瓑鐩稿叧涓撲笟浼樺厛锛屼紭绉�澶т笓瀛﹀巻鑰�') + .fontSize(10) + .margin({ top: 6 }) + .fontColor('#666666') + .lineHeight(15) + .width('100%') + .textAlign(TextAlign.Start) + } + + + } + .padding(10) + .border({ width: 1, style: BorderStyle.Solid, color: this.expandIndex == index ? '#1756f4' : '#f2f2f2' }) + .borderRadius(10) + } + }, (index: number) => index.toString()) + } + .listDirection(Axis.Vertical) // 鎺掑垪鏂瑰悜 + .scrollBar(BarState.Off) + .friction(0.6) + .edgeEffect(EdgeEffect.Spring) + .width('100%') + .height(560) + } - .width('95%') - .padding(10) - .borderRadius(10) - .backgroundColor(Color.White) + .padding({ left: 10, right: 10 }) + .height('100%') } } -@Extend(Text) function SearchTextSty(mSize:number,mWeight?:FontWeight,mColor?: ResourceColor,mLines?: number){ - .fontSize(mSize) - .fontWeight(mWeight? mWeight : 400) - .fontColor(mColor? mColor : Color.Black) - .maxLines(mLines? mLines : 1) - .textOverflow({overflow: TextOverflow.Ellipsis}) - .width('100%') -} \ No newline at end of file diff --git a/entry/src/main/resources/base/media/company_icon.png b/entry/src/main/resources/base/media/company_icon.png new file mode 100644 index 0000000..7210830 --- /dev/null +++ b/entry/src/main/resources/base/media/company_icon.png Binary files differ diff --git a/entry/src/main/resources/base/media/down_icon.png b/entry/src/main/resources/base/media/down_icon.png new file mode 100644 index 0000000..47e4faf --- /dev/null +++ b/entry/src/main/resources/base/media/down_icon.png Binary files differ diff --git a/entry/src/main/resources/base/media/left_icon.png b/entry/src/main/resources/base/media/left_icon.png new file mode 100644 index 0000000..c502a3e --- /dev/null +++ b/entry/src/main/resources/base/media/left_icon.png Binary files differ diff --git a/entry/src/main/resources/base/media/person_icon.png b/entry/src/main/resources/base/media/person_icon.png new file mode 100644 index 0000000..0b1a251 --- /dev/null +++ b/entry/src/main/resources/base/media/person_icon.png Binary files differ diff --git a/entry/src/main/resources/base/media/search_icon.png b/entry/src/main/resources/base/media/search_icon.png new file mode 100644 index 0000000..6236865 --- /dev/null +++ b/entry/src/main/resources/base/media/search_icon.png Binary files differ diff --git a/entry/src/main/resources/base/media/up_icon.png b/entry/src/main/resources/base/media/up_icon.png new file mode 100644 index 0000000..cb404b9 --- /dev/null +++ b/entry/src/main/resources/base/media/up_icon.png Binary files differ diff --git a/entry/src/main/resources/base/media/video_icon.png b/entry/src/main/resources/base/media/video_icon.png new file mode 100644 index 0000000..b6acab6 --- /dev/null +++ b/entry/src/main/resources/base/media/video_icon.png Binary files differ diff --git a/entry/src/main/resources/base/profile/main_pages.json b/entry/src/main/resources/base/profile/main_pages.json index 316bba2..ff4c064 100644 --- a/entry/src/main/resources/base/profile/main_pages.json +++ b/entry/src/main/resources/base/profile/main_pages.json @@ -4,6 +4,11 @@ "pages/StartPage", "pages/login/LoginPage", "pages/login/SignInPage", - "pages/MainPage" + "pages/MainPage", + "pages/home/BannerDetail", + "pages/home/ClassificationDetail", + "pages/home/ActiveDetail", + "pages/search/SearchPage", + "pages/message/MessagePage" ] } diff --git a/oh-package-lock.json5 b/oh-package-lock.json5 index c2f6d1b..9b8016a 100644 --- a/oh-package-lock.json5 +++ b/oh-package-lock.json5 @@ -11,14 +11,14 @@ }, "packages": { "@ohos/hamock@1.0.0": { - "name": "@ohos/hamock", + "name": "", "version": "1.0.0", "integrity": "sha512-K6lDPYc6VkKe6ZBNQa9aoG+ZZMiwqfcR/7yAVFSUGIuOAhPvCJAo9+t1fZnpe0dBRBPxj2bxPPbKh69VuyAtDg==", "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hamock/-/hamock-1.0.0.har", "registryType": "ohpm" }, "@ohos/hypium@1.0.21": { - "name": "@ohos/hypium", + "name": "", "version": "1.0.21", "integrity": "sha512-iyKGMXxE+9PpCkqEwu0VykN/7hNpb+QOeIuHwkmZnxOpI+dFZt6yhPB7k89EgV1MiSK/ieV/hMjr5Z2mWwRfMQ==", "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.21.har", -- Gitblit v1.8.0