From 23fa268f56dcd99c8dcd46f50f3ffcaa4cdcbc49 Mon Sep 17 00:00:00 2001 From: wwf <1971391498@qq.com> Date: 星期五, 10 十月 2025 17:25:53 +0800 Subject: [PATCH] 功能完善 --- entry/src/main/ets/pages/home/ClassificationDetail.ets | 4 entry/src/main/ets/pages/account/LearningRecordPage.ets | 6 entry/src/main/resources/base/media/avatar2.png | 0 entry/src/main/ets/utils/config.ets | 1 entry/src/main/ets/pages/search/SearchPage.ets | 140 +++++++---- entry/src/main/ets/pages/account/MessagePushPage.ets | 6 entry/src/main/ets/pages/MainPage.ets | 2 entry/src/main/ets/pages/message/MessageDetailsPage.ets | 55 +++- entry/src/main/ets/pages/account/PersonVitae.ets | 7 entry/src/main/ets/pages/account/CourseCollection.ets | 6 entry/src/main/resources/base/media/avatar3.png | 0 entry/src/main/ets/pages/login/SignInPage.ets | 5 entry/src/main/resources/base/media/bronze_icon.png | 0 entry/src/main/ets/pages/account/AboutPage.ets | 6 entry/src/main/resources/base/profile/main_pages.json | 2 entry/src/main/ets/pages/home/BannerDetail.ets | 10 entry/src/main/ets/pages/account/UserInfoPage.ets | 97 +++++++ entry/src/main/ets/pages/home/ActiveDetail.ets | 110 ++++++-- entry/src/main/ets/pages/home/Home.ets | 63 ++-- entry/src/main/resources/base/media/avatar1.png | 0 entry/src/main/ets/pages/account/AccountPage.ets | 113 ++++++++- entry/src/main/ets/pages/login/LoginPage.ets | 3 entry/src/main/ets/pages/account/SettingPage.ets | 7 entry/src/main/ets/pages/message/MessagePage.ets | 50 ++- 24 files changed, 504 insertions(+), 189 deletions(-) diff --git a/entry/src/main/ets/pages/MainPage.ets b/entry/src/main/ets/pages/MainPage.ets index 4d99409..841ec5b 100644 --- a/entry/src/main/ets/pages/MainPage.ets +++ b/entry/src/main/ets/pages/MainPage.ets @@ -49,7 +49,7 @@ } else if (this.selectIndex == 2){ MessagePage() } else if (this.selectIndex == 3){ - AccountPage() + AccountPage({ selectIndex: this.selectIndex }) } } }) diff --git a/entry/src/main/ets/pages/account/AboutPage.ets b/entry/src/main/ets/pages/account/AboutPage.ets index 8634909..1c90493 100644 --- a/entry/src/main/ets/pages/account/AboutPage.ets +++ b/entry/src/main/ets/pages/account/AboutPage.ets @@ -1,13 +1,17 @@ +import { router } from "@kit.ArkUI" @Entry @Component -export struct AboutPage { +struct AboutPage { build() { Column() { Row() { Image($r('app.media.left_icon')) .width(20) .height(20) + .onClick(() => { + router.back() + }) Text('鍏充簬') .fontSize(18) .fontWeight(700) diff --git a/entry/src/main/ets/pages/account/AccountPage.ets b/entry/src/main/ets/pages/account/AccountPage.ets index 556bb32..24ce7b6 100644 --- a/entry/src/main/ets/pages/account/AccountPage.ets +++ b/entry/src/main/ets/pages/account/AccountPage.ets @@ -1,6 +1,19 @@ -import { ComponentContent, router } from "@kit.ArkUI" +import { ComponentContent, promptAction, router } from "@kit.ArkUI" import { PromptActionClass } from '../../utils/PromptActionClass'; +import { http } from "@kit.NetworkKit"; +import { HttpResponseResult } from "../../data/HttpResponse"; +import { common } from "@kit.AbilityKit"; +import { ROMAIN } from "../../utils/config"; +export class UserInfo { + nickName: string = '' + mobilePhone: string = '' + age: string = '' + gender: string = '' + job: string = '' + preferJob: string = '' + introduce: string = '' +} class accountListItem { title: string = '' icon: string | Resource = '' @@ -70,7 +83,6 @@ .backgroundColor(Color.White) } -@Entry @Component export struct AccountPage { @State ListItems: accountListItem[] = [ @@ -84,12 +96,47 @@ private contentNode: ComponentContent<Object> = new ComponentContent(this.ctx, wrapBuilder(buildText), new DialogParams((this.dialogMessage))); params: DialogParams = new DialogParams('娉ㄥ唽鎴愬姛') + @State userInfo: UserInfo = { + nickName: '', + mobilePhone: '', + age: '', + gender: '', + job: '', + preferJob: '', + introduce: '', + } + @Link selectIndex: number | undefined; aboutToAppear(): void { PromptActionClass.setContext(this.ctx); PromptActionClass.setContentNode(this.contentNode); PromptActionClass.setOptions({ alignment: DialogAlignment.Center, offset: { dx: 0, dy: 0 } }); + this.getUserInfo() } + + getUserInfo() { + let httpRequest = http.createHttp(); + httpRequest.request( + `${ROMAIN}/quiz-community/public/v1.0/users/userinfo`, + { + method: http.RequestMethod.GET, + header: { 'Content-Type': 'application/json', 'x-jwt-token': `Bearer ${AppStorage.get('x-jwt-token')}` }, + }, + (err, data) => { + console.log('response', '/users/userinfo') + console.log(JSON.stringify(data.result)) + if (data.responseCode == 200) { + const resData = (typeof data.result == 'string' ? JSON.parse(data.result) : data.result) as HttpResponseResult<UserInfo> + if (resData.code == 200) { + this.userInfo = resData.data as UserInfo + } else { + promptAction.showToast({ message: resData.msg }) + } + } + } + ) + } + build() { Column() { Text('涓汉涓績') @@ -106,13 +153,13 @@ .width(50) .height(50) Column() { - Text('鏉庡己') + Text(this.userInfo.nickName || '鏉庡己') .fontSize(16) .width('100%') .fontWeight(600) .fontColor(Color.Black) .textAlign(TextAlign.Start) - Text('鐢� | 28宀� | 鍓嶇寮�鍙戝伐绋嬪笀') + Text(`${this.userInfo.gender || '鐢�'} | ${this.userInfo.age || 28}宀� | ${this.userInfo.job || '鍓嶇寮�鍙戝伐绋嬪笀'}`) .fontColor('#333333') .fontSize(14) .width('100%') @@ -124,13 +171,13 @@ .justifyContent(FlexAlign.SpaceBetween) .layoutWeight(1) Image($r('app.media.chevron_right')) - .width(18) - .height(18) + .width(14) + .height(14) } .width('100%') .onClick(() =>{ router.pushUrl({ - url: '' + url: 'pages/account/UserInfoPage' }) }) @@ -147,14 +194,25 @@ .backgroundColor(Color.White) .padding({ left: 10, right: 10, top: 4, bottom: 4 }) .fontColor('#1756f4') + .onClick(() => { + this.selectIndex = 1 + }) } .width('100%') .justifyContent(FlexAlign.SpaceBetween) - Text('褰撳墠瀛︿範绾у埆锛氶潚閾�') - .width('100%') - .fontColor(Color.White) - .fontSize(14) + Row() { + Text('褰撳墠瀛︿範绾у埆锛氶潚閾�') + .fontColor(Color.White) + .fontSize(14) + Image($r('app.media.bronze_icon')) + .width(20) + .height(20) + .margin({ left: 6 }) + } + .width('100%') + .justifyContent(FlexAlign.Start) + Row() { Column({ space: 4 }) { Text('瀛︿範鏃堕暱') @@ -205,6 +263,12 @@ .fontWeight(500) .fontColor(Color.Black) } + .onClick(() => { + router.pushUrl({ + url: 'pages/account/LearningRecordPage' + }) + }) + Column({ space: 6 }) { Image($r('app.media.account_course')) .width(40) @@ -214,6 +278,12 @@ .fontWeight(500) .fontColor(Color.Black) } + .onClick(() => { + router.pushUrl({ + url: 'pages/account/CourseCollection' + }) + }) + Column({ space: 6 }) { Image($r('app.media.account_vitae')) .width(40) @@ -223,6 +293,12 @@ .fontWeight(500) .fontColor(Color.Black) } + .onClick(() => { + router.pushUrl({ + url: 'pages/account/PersonVitae' + }) + }) + Column({ space: 6 }) { Image($r('app.media.account_communicated')) .width(40) @@ -268,16 +344,20 @@ .onClick(() => { if (item.title == '闅愮璁剧疆') { router.pushUrl({ - url: '' + url: 'pages/account/SettingPage' }) } else if (item.title == '娑堟伅閫氱煡') { - + router.pushUrl({ + url: 'pages/account/MessagePushPage' + }) } else if (item.title == '甯姪涓績') { this.contentNode = new ComponentContent(this.ctx, wrapBuilder(buildText1), new DialogParams((this.dialogMessage))); PromptActionClass.setContentNode(this.contentNode); PromptActionClass.openDialog() } else if (item.title == '鍏充簬鎴戜滑') { - + router.pushUrl({ + url: 'pages/account/AboutPage' + }) } }) } @@ -303,10 +383,13 @@ .width('100%') .fontColor(Color.White) .backgroundColor('#1761f4') + .onClick(() => { + (getContext(this) as common.UIAbilityContext)?.terminateSelf() + }) } .padding(16) .width('100%') - .background(Color.White) + .backgroundColor(Color.White) .height(300) } diff --git a/entry/src/main/ets/pages/account/CourseCollection.ets b/entry/src/main/ets/pages/account/CourseCollection.ets index 39afb2f..171144f 100644 --- a/entry/src/main/ets/pages/account/CourseCollection.ets +++ b/entry/src/main/ets/pages/account/CourseCollection.ets @@ -1,3 +1,4 @@ +import { router } from '@kit.ArkUI' class Course { title: string = '' @@ -8,7 +9,7 @@ } @Entry @Component -export struct CourseCollection { +struct CourseCollection { @State courseList: Course[] = [ { title: '闆跺熀纭�鍒颁紒涓氱骇椤圭洰瀹炴垬', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, { title: '闆跺熀纭�鍒颁紒涓氱骇椤圭洰瀹炴垬', 'desc': '閽堝闆跺熀纭�灏忕櫧鎴栨兂鍗囩骇鎶�鏈爤鐨勫墠绔粠涓氳�咃紝浠庢牳蹇冭娉曞叆鎵嬶紝閫愭娣卞叆Vue3缁勪欢寮�鍙戞墦浠跺紑鍙戜欢寮�鍙�', count: '800', time: '01:30:23', difficult: '绠�鍗�' }, @@ -34,6 +35,9 @@ Image($r('app.media.left_icon')) .width(20) .height(20) + .onClick(() => { + router.back() + }) Text('璇剧▼鏀惰棌') .fontSize(18) .fontWeight(700) diff --git a/entry/src/main/ets/pages/account/LearningRecordPage.ets b/entry/src/main/ets/pages/account/LearningRecordPage.ets index ed49d4c..feffa35 100644 --- a/entry/src/main/ets/pages/account/LearningRecordPage.ets +++ b/entry/src/main/ets/pages/account/LearningRecordPage.ets @@ -1,8 +1,9 @@ import { McLineChart, Options } from '@mcui/mccharts' +import { router } from '@kit.ArkUI' @Entry @Component -export struct LearningRecordPage { +struct LearningRecordPage { @State maxData: number[] = [0, 0, 0, 5, 0, 5, 0] // 鍒濆鍖栨暟鎹� @State seriesOption: Options = new Options({ @@ -26,6 +27,9 @@ Image($r('app.media.left_icon')) .width(20) .height(20) + .onClick(() => { + router.back() + }) Text('瀛︿範璁板綍') .fontSize(18) .fontWeight(700) diff --git a/entry/src/main/ets/pages/account/MessagePushPage.ets b/entry/src/main/ets/pages/account/MessagePushPage.ets index d88e397..a613382 100644 --- a/entry/src/main/ets/pages/account/MessagePushPage.ets +++ b/entry/src/main/ets/pages/account/MessagePushPage.ets @@ -1,3 +1,4 @@ +import { router } from '@kit.ArkUI' class MessageItem { icon: string | Resource = '' @@ -9,7 +10,7 @@ @Entry @Component -export struct MessagePushPage { +struct MessagePushPage { @State messagePushFlag: boolean = false @State autoUpdateFlag: boolean = false @State messageList: MessageItem[] = [ @@ -23,6 +24,9 @@ Image($r('app.media.left_icon')) .width(20) .height(20) + .onClick(() => { + router.back() + }) Text('娑堟伅閫氱煡') .fontSize(18) .fontWeight(700) diff --git a/entry/src/main/ets/pages/account/PersonVitae.ets b/entry/src/main/ets/pages/account/PersonVitae.ets index e57b128..49ceda6 100644 --- a/entry/src/main/ets/pages/account/PersonVitae.ets +++ b/entry/src/main/ets/pages/account/PersonVitae.ets @@ -1,12 +1,17 @@ +import { router } from '@kit.ArkUI' + @Entry @Component -export struct CourseCollection { +struct PersonVitae { build() { Column() { Row() { Image($r('app.media.left_icon')) .width(20) .height(20) + .onClick(() => { + router.back() + }) Text('涓汉绠�鍘�') .fontSize(18) .fontWeight(700) diff --git a/entry/src/main/ets/pages/account/SettingPage.ets b/entry/src/main/ets/pages/account/SettingPage.ets index 4812ebe..8a62202 100644 --- a/entry/src/main/ets/pages/account/SettingPage.ets +++ b/entry/src/main/ets/pages/account/SettingPage.ets @@ -1,6 +1,8 @@ +import { router } from '@kit.ArkUI' + @Entry @Component -export struct SettingPage { +struct SettingPage { @State messagePushFlag: boolean = false @State autoUpdateFlag: boolean = false build() { @@ -9,6 +11,9 @@ Image($r('app.media.left_icon')) .width(20) .height(20) + .onClick(() => { + router.back() + }) Text('闅愮璁剧疆') .fontSize(18) .fontWeight(700) diff --git a/entry/src/main/ets/pages/account/UserInfoPage.ets b/entry/src/main/ets/pages/account/UserInfoPage.ets index fe4f735..275f0bb 100644 --- a/entry/src/main/ets/pages/account/UserInfoPage.ets +++ b/entry/src/main/ets/pages/account/UserInfoPage.ets @@ -1,12 +1,87 @@ +import { promptAction, router } from "@kit.ArkUI" +import { http } from "@kit.NetworkKit" +import { HttpResponseResult } from "../../data/HttpResponse" +import { ROMAIN } from "../../utils/config" +import { UserInfo } from "./AccountPage" + @Entry @Component -export struct UserInfo { +struct UserInfoPage { @State nickName: string = '' @State gender: string = '' @State age: string = '' @State preferJob: string = '' @State job: string = '' @State introduce: string = '' + @State userInfo: UserInfo = { + nickName: '', + mobilePhone: '', + age: '', + gender: '', + job: '', + preferJob: '', + introduce: '', + } + + aboutToAppear(): void { + this.getUserInfo() + } + + getUserInfo() { + let httpRequest = http.createHttp(); + httpRequest.request( + `${ROMAIN}/quiz-community/public/v1.0/users/userinfo`, + { + method: http.RequestMethod.GET, + header: { 'Content-Type': 'application/json', 'x-jwt-token': `Bearer ${AppStorage.get('x-jwt-token')}` }, + }, + (err, data) => { + console.log('response', '/users/userinfo') + console.log(JSON.stringify(data.result)) + if (data.responseCode == 200) { + const resData = (typeof data.result == 'string' ? JSON.parse(data.result) : data.result) as HttpResponseResult<UserInfo> + if (resData.code == 200) { + this.userInfo = resData.data as UserInfo + } else { + promptAction.showToast({ message: resData.msg }) + } + } + } + ) + } + + saveInfo() { + let httpRequest = http.createHttp(); + let postData: UserInfo = { + nickName: this.userInfo.nickName, + mobilePhone: '', + age: this.userInfo.age, + gender: this.userInfo.gender, + job: this.userInfo.job, + preferJob: this.userInfo.preferJob, + introduce: this.userInfo.introduce + } + httpRequest.request( + `${ROMAIN}/quiz-community/public/v1.0/users/userinfo`, + { + method: http.RequestMethod.PUT, + header: { 'Content-Type': 'application/json' }, + extraData: postData + }, + (err, data) => { + console.log('response', '/users/userinfo') + console.log(JSON.stringify(data.result)) + if (data.responseCode == 200) { + const resData = (typeof data.result == 'string' ? JSON.parse(data.result) : data.result) as HttpResponseResult<string> + if (resData.code == 200) { + promptAction.showToast({ message: '淇濆瓨鎴愬姛' }) + } else { + promptAction.showToast({ message: resData.msg }) + } + } + } + ) + } build() { Column() { @@ -14,6 +89,9 @@ Image($r('app.media.left_icon')) .width(20) .height(20) + .onClick(() => { + router.back() + }) Text('涓汉淇℃伅') .fontSize(18) .fontWeight(700) @@ -31,7 +109,7 @@ .fontSize(14) .fontColor('#666666') .width('100%') - TextInput({ placeholder: '璇疯緭鍏�', text: this.nickName }) + TextInput({ placeholder: '璇疯緭鍏�', text: $$this.userInfo.nickName }) .placeholderFont({ size: 14 }) .showUnderline(true) .margin({ top: -6 }) @@ -42,7 +120,7 @@ .fontSize(14) .fontColor('#666666') .width('100%') - TextInput({ placeholder: '璇疯緭鍏�', text: this.gender }) + TextInput({ placeholder: '璇疯緭鍏�', text: $$this.userInfo.gender }) .placeholderFont({ size: 14 }) .showUnderline(true) .margin({ top: -6 }) @@ -53,7 +131,7 @@ .fontSize(14) .fontColor('#666666') .width('100%') - TextInput({ placeholder: '璇疯緭鍏�', text: this.age }) + TextInput({ placeholder: '璇疯緭鍏�', text: $$this.userInfo.age }) .placeholderFont({ size: 14 }) .showUnderline(true) .margin({ top: -6 }) @@ -64,7 +142,7 @@ .fontSize(14) .fontColor('#666666') .width('100%') - TextInput({ placeholder: '璇疯緭鍏�', text: this.job }) + TextInput({ placeholder: '璇疯緭鍏�', text: $$this.userInfo.job }) .placeholderFont({ size: 14 }) .showUnderline(true) .margin({ top: -6 }) @@ -75,7 +153,7 @@ .fontSize(14) .fontColor('#666666') .width('100%') - TextInput({ placeholder: '璇疯緭鍏�', text: this.preferJob }) + TextInput({ placeholder: '璇疯緭鍏�', text: $$this.userInfo.preferJob }) .placeholderFont({ size: 14 }) .showUnderline(true) .margin({ top: -6 }) @@ -86,13 +164,13 @@ .fontColor('#666666') .fontSize(14) .width('100%') - TextArea({ placeholder: '浠嬬粛涓�涓嬩綘鑷繁鍚', text: this.job }) + TextArea({ placeholder: '浠嬬粛涓�涓嬩綘鑷繁鍚', text: this.userInfo.introduce }) .placeholderFont({ size: 14 }) .backgroundColor('#fff') .border({ width: 1, color: '#666666' }) .borderRadius(5) - .minLines(10) .maxLength(200) + .constraintSize({ minHeight: 200 }) .showCounter(true) .margin({ top: 10 }) } @@ -105,6 +183,9 @@ .width('100%') .fontColor(Color.White) .backgroundColor('#1761f4') + .onClick(() => { + this.saveInfo() + }) } .height('100%') diff --git a/entry/src/main/ets/pages/home/ActiveDetail.ets b/entry/src/main/ets/pages/home/ActiveDetail.ets index 1865836..93bb3ee 100644 --- a/entry/src/main/ets/pages/home/ActiveDetail.ets +++ b/entry/src/main/ets/pages/home/ActiveDetail.ets @@ -1,38 +1,97 @@ -import { router } from "@kit.ArkUI" +import { promptAction, router } from "@kit.ArkUI" +import { http } from "@kit.NetworkKit" +import { LvMarkdownIn } from "@luvi/lv-markdown-in" +import { HttpResponseResult } from "../../data/HttpResponse" +import { ROMAIN } from "../../utils/config" + +class Activity { + id: string = '' + name: string = '' + pic: string = '' + startDate: string = '' + endTime: string = '' + signupCount: number = 0 + status: string = '' + content: string = '' +} @Entry @Component export struct ActiveDetail { - @State index: number = 0 + @State hotTrainingId: string = '' + @State activeInfo: Activity = { + id: '', + name: '', + pic: '', + startDate: '', + endTime: '', + signupCount: 0, + status: '', + content: '', + } aboutToAppear(): void { interface Params { - index: number + id: string } const params: Params = router.getParams() as Params - this.index = params.index + this.hotTrainingId = params.id + this.getDetail() } + getDetail() { + let httpRequest = http.createHttp(); + httpRequest.request( + `${ROMAIN}/quiz-community/public/v1.0/home/hotTraining/details?hotTrainingId=${this.hotTrainingId}`, + { + method: http.RequestMethod.GET, + header: { 'Content-Type': 'application/json', 'x-jwt-token': `Bearer ${AppStorage.get('x-jwt-token')}` }, + }, + (err, data) => { + console.log('response', '/home/hotTraining/details') + console.log(JSON.stringify(data.result)) + if (data.responseCode == 200) { + const resData = (typeof data.result == 'string' ? JSON.parse(data.result) : data.result) as HttpResponseResult<Activity> + if (resData.code == 200) { + this.activeInfo = resData.data as Activity + } else { + promptAction.showToast({ message: resData.msg }) + } + } + } + ) + } getTagFontColor(statusText: string) { switch (statusText) { - case '鎶ュ悕涓�': + case 'signup': return '#10920e' - case '杩涜涓�': + case 'training': return '#ffa100' default : return '#666666' } } - getTagBgColor(statusText: string) { - switch (statusText) { - case '鎶ュ悕涓�': + getTagBgColor(status: string) { + switch (status) { + case 'signup': return '#d5f2db' - case '杩涜涓�': + case 'training': return '#fff0cc' default : return '#ebebeb' } + } + + getStatusText(status: string) { + if (status == 'signup') { + return '鎶ュ悕涓�' + } else if (status == 'training') { + return '杩涜涓�' + } else if (status == 'finished') { + return '宸茬粨鏉�' + } + return '' } build() { @@ -41,6 +100,9 @@ Image($r('app.media.left_icon')) .width(20) .height(20) + .onClick(() => { + router.back() + }) Text('璇︽儏椤�') .fontSize(18) .fontWeight(700) @@ -55,50 +117,40 @@ .height(150) Column({ space: 14 }) { - Text('鍖椾含浜哄伐鏅鸿兘IE') + Text(this.activeInfo.name) .fontWeight(800) .width('100%') Row({ space: 10 }) { - Text('鎶ュ悕涓�') + Text(this.getStatusText(this.activeInfo.status)) .fontSize(10) .fontWeight(500) .padding({ left: 4, right: 4, top: 2, bottom: 2 }) .borderRadius(10) - .fontColor(this.getTagFontColor('鎶ュ悕涓�')) - .backgroundColor(this.getTagBgColor('鎶ュ悕涓�')) + .fontColor(this.getTagFontColor(this.activeInfo.status)) + .backgroundColor(this.getTagBgColor(this.activeInfo.status)) Row() { Image($r('app.media.date_icon')) .width(12) .height(12) - Text('20250520-20250620') + Text(`${this.activeInfo.startDate}-${this.activeInfo.endTime}`) .fontSize(10) .fontColor('#676767') .margin({ left: 4 }) } - Text(`80浜哄凡鎶ュ悕`) + Text(`${this.activeInfo.signupCount}浜哄凡鎶ュ悕`) .fontSize(10) .fontColor('#676767') } .width('100%') .justifyContent(FlexAlign.Start) - Text('璇剧▼浠嬬粛') + LvMarkdownIn({ text: this.activeInfo.content }) .width('100%') - .fontSize(14) - .fontWeight(800) - - Text('鏈绋嬫槸璁$畻鏈虹綉缁滄妧鏈�侀�氫俊鎶�鏈瓑涓撲笟鐨勪笓涓氭牳蹇冭绋嬶紝鏃ㄥ湪鍩瑰吇瀛︾敓鐨勭綉缁滄妧鏈亴涓氳兘鍔涖�佽亴涓氱礌鍏诲拰鍒涙柊鑳藉姏銆�' + - '\n閲囩敤椤圭洰寮忓疄璁暀瀛︼紝閫氳繃寮曞叆涓�涓惊搴忔笎杩涚殑浼佷笟缃戠粶缁勫缓妗堜緥锛岃瀛︾敓鍦ㄦā鎷熺湡瀹炲満鏅腑鎺屾彙涓皬鍨嬩紒涓氱綉缁滅粍寤虹殑鐭ヨ瘑鍜岃兘鍔�' + - '鏁欐潗鍐呭瑕嗙洊鍗庝负鈥�1+X鈥濊瘉涔﹁�冭瘯瑕佹眰锛屽寘鍚ぇ閲忓疄鎿嶇粌涔犮��') - .width('100%') - .fontSize(13) - .lineHeight(20) + .height(560) + .padding({ left: 10, right: 10 }) } .padding(14) - - - } .width('100%') .height('100%') diff --git a/entry/src/main/ets/pages/home/BannerDetail.ets b/entry/src/main/ets/pages/home/BannerDetail.ets index 832260e..3515a22 100644 --- a/entry/src/main/ets/pages/home/BannerDetail.ets +++ b/entry/src/main/ets/pages/home/BannerDetail.ets @@ -2,6 +2,7 @@ import { http } from "@kit.NetworkKit"; import { HttpResponseResult } from "../../data/HttpResponse"; import { LvMarkdownIn } from "@luvi/lv-markdown-in" +import { ROMAIN } from "../../utils/config"; class BannerInfo { pic: string = '' @@ -30,15 +31,9 @@ } getDetail() { - interface PostData { - bannerId: string, - } - let postData: PostData = { - bannerId: this.bannerId - } let httpRequest = http.createHttp(); httpRequest.request( - `http://192.168.20.70:8080/quiz-community/public/v1.0/home/slideshows/details?bannerId=${this.bannerId}`, + `${ROMAIN}/quiz-community/public/v1.0/home/slideshows/details?bannerId=${this.bannerId}`, { method: http.RequestMethod.GET, header: { 'Content-Type': 'application/json', 'x-jwt-token': `Bearer ${AppStorage.get('x-jwt-token')}` }, @@ -83,6 +78,7 @@ LvMarkdownIn({ text: this.bannerInfo.content.toString() }) .width('100%') .height(560) + .padding({ left: 10, right: 10 }) } .width('100%') diff --git a/entry/src/main/ets/pages/home/ClassificationDetail.ets b/entry/src/main/ets/pages/home/ClassificationDetail.ets index 8bed77c..ae5cc86 100644 --- a/entry/src/main/ets/pages/home/ClassificationDetail.ets +++ b/entry/src/main/ets/pages/home/ClassificationDetail.ets @@ -2,6 +2,7 @@ import { http } from "@kit.NetworkKit" import { LvMarkdownIn } from "@luvi/lv-markdown-in" import { HttpResponseResult } from "../../data/HttpResponse" +import { ROMAIN } from "../../utils/config" @Entry @Component @@ -20,7 +21,7 @@ getDetail() { let httpRequest = http.createHttp(); httpRequest.request( - `http://192.168.20.70:8080/quiz-community/public/v1.0/home/module/details?moduleName=${this.moduleName}`, + `${ROMAIN}/quiz-community/public/v1.0/home/module/details?moduleName=${this.moduleName}`, { method: http.RequestMethod.GET, header: { 'Content-Type': 'application/json', 'x-jwt-token': `Bearer ${AppStorage.get('x-jwt-token')}` }, @@ -66,6 +67,7 @@ LvMarkdownIn({ text: this.content.toString() }) .width('100%') .height(560) + .padding({ left: 10, right: 10 }) } .width('100%') .height('100%') diff --git a/entry/src/main/ets/pages/home/Home.ets b/entry/src/main/ets/pages/home/Home.ets index e97d195..6a3bf19 100644 --- a/entry/src/main/ets/pages/home/Home.ets +++ b/entry/src/main/ets/pages/home/Home.ets @@ -2,6 +2,7 @@ import http from '@ohos.net.http'; import { HttpResponseResult } from "../../data/HttpResponse"; import { JSON } from "@kit.ArkTS"; +import { ROMAIN } from "../../utils/config"; class TabBarBase { title: string = '' @@ -61,25 +62,9 @@ { title: '鏇村', value: '', icon: $r('app.media.classification_more') }, ] @State activityList: Activity[] = [] - @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: '绠�鍗�' }, - - ] + @State origCourseList: Course[] = [] + @State courseList: Course[] = [] + @State @Watch('filterCourseList') searchKeyword: string = '' @Builder tabBarItem(name:string,index: number){ Row(){ @@ -128,6 +113,28 @@ return '' } + getDifficultText(difficult: number) { + if (difficult == 1) { + return '绠�鍗�' + } else if (difficult == 2) { + return '涓瓑' + } else if (difficult == 3) { + return '鍥伴毦' + } + return '' + } + + filterCourseList() { + if (this.searchKeyword) { + let list = this.origCourseList.filter((ele: Course) => { + return ele.name.includes(this.searchKeyword) || ele.description.includes(this.searchKeyword) + }) + this.courseList = list + } else { + this.courseList = this.origCourseList + } + } + aboutToAppear(): void { this.getBannerList() this.getActivityList() @@ -137,7 +144,7 @@ getBannerList() { let httpRequest = http.createHttp(); httpRequest.request( - "http://192.168.20.70:8080/quiz-community/public/v1.0/home/slideshows", + `${ROMAIN}/quiz-community/public/v1.0/home/slideshows`, { method: http.RequestMethod.GET, header: { 'Content-Type': 'application/json', 'x-jwt-token': `Bearer ${AppStorage.get('x-jwt-token')}` }, @@ -160,7 +167,7 @@ getActivityList() { let httpRequest = http.createHttp(); httpRequest.request( - "http://192.168.20.70:8080/quiz-community/public/v1.0/home/hotTraining", + `${ROMAIN}/quiz-community/public/v1.0/home/hotTraining`, { method: http.RequestMethod.GET, header: { 'Content-Type': 'application/json', 'x-jwt-token': `Bearer ${AppStorage.get('x-jwt-token')}` }, @@ -183,7 +190,7 @@ getCourseList() { let httpRequest = http.createHttp(); httpRequest.request( - "http://192.168.20.70:8080/quiz-community/public/v1.0/home/courses", + `${ROMAIN}/quiz-community/public/v1.0/home/courses`, { method: http.RequestMethod.GET, header: { 'Content-Type': 'application/json', 'x-jwt-token': `Bearer ${AppStorage.get('x-jwt-token')}` }, @@ -194,7 +201,8 @@ if (data.responseCode == 200) { const resData = (typeof data.result == 'string' ? JSON.parse(data.result) : data.result) as HttpResponseResult<Course[]> if (resData.code == 200) { - this.courseList = resData.data || [] + this.origCourseList = resData.data || [] + this.filterCourseList() } else { promptAction.showToast({ message: resData.msg }) } @@ -331,7 +339,7 @@ router.pushUrl({ url: 'pages/home/ActiveDetail', params: { - index: index + id: item.id } }) }) @@ -360,7 +368,7 @@ Image($r('app.media.search_icon')) .width(14) .height(14) - TextInput({ placeholder: '鎼滅储鎯宠鏌ユ壘鐨勫唴瀹�' }) + TextInput({ placeholder: '鎼滅储鎯宠鏌ユ壘鐨勫唴瀹�', text: $$this.searchKeyword }) .placeholderFont({ size: 14}) .placeholderColor('#999999') .backgroundColor('#f3f7fe') @@ -404,7 +412,7 @@ } Text() { Span('璇剧▼闅惧害: ') - Span(`${item.difficulty}`) + Span(this.getDifficultText(item.difficulty)) } .fontSize(10) .fontColor('#666666') @@ -436,8 +444,7 @@ .friction(0.6) .edgeEffect(EdgeEffect.Spring) .width('100%') - .height(530) - + .height(580) } .height('100%') }.tabBar(this.tabBarItem(item.title, index)) diff --git a/entry/src/main/ets/pages/login/LoginPage.ets b/entry/src/main/ets/pages/login/LoginPage.ets index aad009d..c3e9a96 100644 --- a/entry/src/main/ets/pages/login/LoginPage.ets +++ b/entry/src/main/ets/pages/login/LoginPage.ets @@ -4,6 +4,7 @@ import http from '@ohos.net.http'; import { HttpResponseResult } from '../../data/HttpResponse'; import { JSON } from '@kit.ArkTS'; +import { ROMAIN } from '../../utils/config'; /** * @Description : 鐧诲綍椤� @@ -67,7 +68,7 @@ } httpRequest.request( - "http://192.168.20.70:8080/quiz-community/public/v1.0/users/login", + `${ROMAIN}/quiz-community/public/v1.0/users/login`, { method: http.RequestMethod.PUT, header: { 'Content-Type': 'application/json' }, diff --git a/entry/src/main/ets/pages/login/SignInPage.ets b/entry/src/main/ets/pages/login/SignInPage.ets index 011d93c..cb0235a 100644 --- a/entry/src/main/ets/pages/login/SignInPage.ets +++ b/entry/src/main/ets/pages/login/SignInPage.ets @@ -3,6 +3,7 @@ import { HttpResponseResult } from '../../data/HttpResponse'; import { ComponentContent } from '@kit.ArkUI'; import { PromptActionClass } from '../../utils/PromptActionClass'; +import { ROMAIN } from '../../utils/config'; class DialogParams { text: string = ""; @@ -90,7 +91,7 @@ } httpRequest.request( - "http://192.168.20.70:8080/quiz-community/public/v1.0/users/register", + `${ROMAIN}/quiz-community/public/v1.0/users/register`, { method: http.RequestMethod.POST, header: { 'Content-Type': 'application/json' }, @@ -106,8 +107,6 @@ } else { promptAction.showToast({ message: resData.msg }) } - } else { - promptAction.showToast({ message: err.message }) } } ) diff --git a/entry/src/main/ets/pages/message/MessageDetailsPage.ets b/entry/src/main/ets/pages/message/MessageDetailsPage.ets index a2ea405..8594cff 100644 --- a/entry/src/main/ets/pages/message/MessageDetailsPage.ets +++ b/entry/src/main/ets/pages/message/MessageDetailsPage.ets @@ -12,13 +12,28 @@ @State messageList: Message[] = [ { avatar: '', content: '璇峰彂涓�涓嬩綘鐨勭畝鍘嗙粰鎴戙��', isMe: false }, { avatar: '', content: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴戣寰楁垜鍙互鑳滀换杩欎釜宀椾綅', isMe: true }, - ] - aboutToAppear(): void { + @State avatar: string | Resource = '' + @State name: string = '' + @State company: string = '' + @State pageHeight: number = 0 + @State chatHeight: number = 0 + @State inputText: string = '' + aboutToAppear(): void { + interface Params { + avatar: string | Resource + name: string + company: string + } + const params: Params = router.getParams() as Params + this.name = params.name + this.company = params.company + this.avatar = params.avatar } + build() { - Column() { + Flex({ direction: FlexDirection.Column }) { Row() { Image($r('app.media.left_icon')) .width(20) @@ -27,21 +42,21 @@ router.back() }) Column() { - Text('鏉庡コ澹�') + Text(this.name) .fontSize(16) .fontWeight(700) - Text('鎽╃背绉诲姩绉戞妧') + Text(this.company) .fontSize(12) .fontColor('#666666') .margin({ top: 4 }) } - Row() } .width('100%') .padding(10) .justifyContent(FlexAlign.SpaceBetween) .backgroundColor('#fff') + .expandSafeArea() Column() { List({ space: 20, initialIndex: 0 }){ @@ -66,7 +81,7 @@ .alignItems(VerticalAlign.Bottom) } else { Row({ space: 10 }) { - Image($r('app.media.avatar')) + Image(this.avatar) .width(32) .height(32) Text(item.content) @@ -91,31 +106,43 @@ .edgeEffect(EdgeEffect.Spring) .width('100%') } + .layoutWeight(1) .padding(16) .width('100%') - .height(600) + .expandSafeArea() Row({ space: 8 }) { Image($r('app.media.audio_icon')) .width(24) .height(24) - TextInput() - .width(240) + TextInput({ text: $$this.inputText }) + .layoutWeight(1) .placeholderColor('#999999') .backgroundColor('#f3f7fe') Image($r('app.media.expression_icon')) .width(24) .height(24) - Image($r('app.media.add_icon')) - .width(24) - .height(24) + if (this.inputText) { + Button('鍙戦��') + .type(ButtonType.Normal) + .borderRadius(6) + .onClick(() => { + this.messageList.push({ + avatar: '', content: this.inputText, isMe: true + }) + this.inputText = '' + }) + } else { + Image($r('app.media.add_icon')) + .width(24) + .height(24) + } } .backgroundColor('#FFF') .width('100%') .height(60) .padding(10) .alignItems(VerticalAlign.Center) - } .width('100%') .height('100%') diff --git a/entry/src/main/ets/pages/message/MessagePage.ets b/entry/src/main/ets/pages/message/MessagePage.ets index bec2112..468c606 100644 --- a/entry/src/main/ets/pages/message/MessagePage.ets +++ b/entry/src/main/ets/pages/message/MessagePage.ets @@ -10,23 +10,28 @@ @Entry @Component export struct MessagePage { - @State messageList: Message[] = [ - { avatar: '', name: '鏉庡コ澹�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...', price: '20-35K路14钖�' }, - { avatar: '', name: '鏋楀厛鐢�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...', price: '20-35K路14钖�' }, - { avatar: '', name: '鍚村コ澹�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...', price: '20-35K' }, - { avatar: '', name: '鏉庡コ澹�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...', price: '20-35K路14钖�' }, - { avatar: '', name: '鏋楀厛鐢�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...', price: '20-35K路14钖�' }, - { avatar: '', name: '鍚村コ澹�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...', price: '20-35K' }, - { avatar: '', name: '鏉庡コ澹�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...', price: '20-35K路14钖�' }, - { avatar: '', name: '鏋楀厛鐢�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...', price: '20-35K路14钖�' }, - { avatar: '', name: '鍚村コ澹�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...', price: '20-35K' }, - { avatar: '', name: '鏉庡コ澹�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...', price: '20-35K路14钖�' }, - { avatar: '', name: '鏋楀厛鐢�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...', price: '20-35K路14钖�' }, - { avatar: '', name: '鍚村コ澹�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...', price: '20-35K' }, - { avatar: '', name: '鏉庡コ澹�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...', price: '20-35K路14钖�' }, - { avatar: '', name: '鏋楀厛鐢�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...', price: '20-35K路14钖�' }, - { avatar: '', name: '鍚村コ澹�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...', price: '20-35K' }, + @State origMessageList: Message[] = [ + { avatar: $r('app.media.avatar1'), name: '鏉庡コ澹�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴戣寰楁垜鍙互鑳滀换杩欎釜宀椾綅', price: '20-35K路14钖�' }, + { avatar: $r('app.media.avatar2'), name: '鏋楀厛鐢�', company: '浜戞灑鍓嶇鎶�鏈湁闄愬叕鍙竱楂樼骇寮�鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴戣寰楁垜鍙互鑳滀换杩欎釜宀椾綅', price: '20-40K路14钖�' }, + { avatar: $r('app.media.avatar3'), name: '鍚村コ澹�', company: '鎿庡渤鍚庣绉戞妧|鍚庣寮�鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴戣寰楁垜鍙互鑳滀换杩欎釜宀椾綅', price: '20-35K路13钖�' }, ] + @State @Watch('filterMessageList') searchKeyword: string = '' + @State messageList: Message[] = [] + + filterMessageList() { + if (this.searchKeyword) { + let list = this.origMessageList.filter((ele: Message) => { + return ele.name.includes(this.searchKeyword) || ele.company.includes(this.searchKeyword) + }) + this.messageList = list + } else { + this.messageList = this.origMessageList + } + } + + aboutToAppear(): void { + this.filterMessageList() + } build() { Column({space: 10}) { @@ -40,7 +45,7 @@ Image($r('app.media.search_icon')) .width(14) .height(14) - TextInput({ placeholder: '鎼滅储鎯宠鏌ユ壘鐨勫矖浣�' }) + TextInput({ placeholder: '鎼滅储鐩稿叧宀椾綅', text: $$this.searchKeyword }) .placeholderFont({ size: 14}) .placeholderColor('#999999') .backgroundColor('#f3f7fe') @@ -55,7 +60,7 @@ ForEach(this.messageList, (item: Message) => { ListItem() { Row() { - Image($r('app.media.avatar')) + Image(item.avatar) .width(40) .height(40) .margin({ right: 10 }) @@ -93,7 +98,12 @@ .margin({ top: 10, bottom: 10 }) .onClick(() => { router.pushUrl({ - url: 'pages/message/MessageDetailsPage' + url: 'pages/message/MessageDetailsPage', + params: { + avatar: item.avatar, + name: item.name, + company: item.company + } }) }) } @@ -104,7 +114,7 @@ .friction(0.6) .edgeEffect(EdgeEffect.Spring) .width('100%') - .height(560) + .height(610) .divider({strokeWidth: 1,color: '#f0f0f0'}) } .height('100%') diff --git a/entry/src/main/ets/pages/search/SearchPage.ets b/entry/src/main/ets/pages/search/SearchPage.ets index 6ceb8d4..8cf6fa6 100644 --- a/entry/src/main/ets/pages/search/SearchPage.ets +++ b/entry/src/main/ets/pages/search/SearchPage.ets @@ -1,33 +1,65 @@ -import { IconType } from "@kit.ArkUI" +import { IconType, promptAction } from "@kit.ArkUI" +import { http } from "@kit.NetworkKit" +import { LvMarkdownIn } from "@luvi/lv-markdown-in" +import { HttpResponseResult } from "../../data/HttpResponse" +import { ROMAIN } from "../../utils/config" class JobItem { - title: string = '' - payment: string = '' - tagList: string[] = [] - company: string = '' - address: string = '' - detail: string = '' + ability: string = '' + addr: string = '' + companyName: string = '' + degree: string = '' + exp: string = '' + jobName: string = '' + salary: string = '' } @Entry @Component export struct SearchPage { - @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 + @State jobList: JobItem[] = [] + @State expandIndex: number | null = null + @State @Watch('filterJobList') searchKeyword: string = '' + @State origJobList: JobItem[] = [] + + aboutToAppear(): void { + this.getJobList() + } + + getJobList() { + let httpRequest = http.createHttp(); + httpRequest.request( + `${ROMAIN}/quiz-community/public/v1.0/home/seek/job`, + { + method: http.RequestMethod.GET, + header: { 'Content-Type': 'application/json', 'x-jwt-token': `Bearer ${AppStorage.get('x-jwt-token')}` }, + }, + (err, data) => { + console.log('response', '/home/seek/job') + console.log(JSON.stringify(data.result)) + if (data.responseCode == 200) { + const resData = (typeof data.result == 'string' ? JSON.parse(data.result) : data.result) as HttpResponseResult<JobItem[]> + if (resData.code == 200) { + this.origJobList = resData.data as JobItem[] + this.filterJobList() + } else { + promptAction.showToast({ message: resData.msg }) + } + } + } + ) + } + + filterJobList() { + if (this.searchKeyword) { + let list = this.origJobList.filter((ele: JobItem) => { + return ele.companyName.includes(this.searchKeyword) || ele.jobName.includes(this.searchKeyword) + }) + this.jobList = list + } else { + this.jobList = this.origJobList + } + } build() { Column({ space: 10 }) { @@ -42,7 +74,7 @@ Image($r('app.media.search_icon')) .width(14) .height(14) - TextInput({ placeholder: '鎼滅储鎯宠鏌ユ壘鐨勫矖浣�' }) + TextInput({ placeholder: '鎼滅储鎯宠鏌ユ壘鐨勫矖浣�', text: $$this.searchKeyword }) .placeholderFont({ size: 14}) .placeholderColor('#999999') .backgroundColor('#f3f7fe') @@ -59,18 +91,22 @@ Column() { Row({ space: 10 }) { Column() { - Text(item.title) - .fontSize(14) - .fontWeight(800) + Text(item.jobName) + .fontSize(18) + .fontWeight(700) Row({ space: 10 }) { - ForEach(item.tagList, (tag: string) => { - Text(tag) - .padding(4) - .borderRadius(4) - .fontSize(10) - .fontColor('#999999') - .backgroundColor('#f5f5f5') - }) + Text(item.exp) + .padding(4) + .borderRadius(4) + .fontSize(12) + .fontColor('#999999') + .backgroundColor('#f5f5f5') + Text(item.degree) + .padding(4) + .borderRadius(4) + .fontSize(12) + .fontColor('#999999') + .backgroundColor('#f5f5f5') } .width('100%') .justifyContent(FlexAlign.Start) @@ -80,8 +116,8 @@ .width(16) .height(16) - Text(item.company) - .fontSize(10) + Text(item.companyName) + .fontSize(12) } } @@ -92,13 +128,13 @@ .alignItems(HorizontalAlign.Start) Column() { - Text(item.payment) + Text(item.salary) .fontColor('#1756f4') - .fontSize(14) - .fontWeight(800) - Text(item.address) + .fontSize(16) + .fontWeight(700) + Text(item.addr) .fontColor('#a6a6a6') - .fontSize(10) + .fontSize(12) } .height('100%') .justifyContent(FlexAlign.SpaceBetween) @@ -111,12 +147,12 @@ Row() { Text() { - Span(this.expandIndex == index ? '鏀惰捣' : '灞曞紑') + Span(this.expandIndex == index ? '鏀惰捣' : '鏌ョ湅') Span('宀椾綅瑕佹眰') } - .fontSize(10) + .fontSize(12) .fontColor('#666666') - Image(this.expandIndex == index ? $r('app.media.down_icon') : $r('app.media.up_icon')) + Image(this.expandIndex == index ? $r('app.media.up_icon') : $r('app.media.down_icon')) .width(14) .height(14) .margin({ left: 4 }) @@ -143,17 +179,10 @@ .margin({ top: 10 }) .width('100%') .textAlign(TextAlign.Start) - Text('1.瀛﹀巻瑕佹眰锛氭湰绉戝強浠ヤ笂瀛﹀巻锛岃绠楁満绉戝涓庢妧鏈�佽蒋浠跺伐绋嬬瓑鐩稿叧涓撲笟浼樺厛锛屼紭绉�澶т笓瀛﹀巻鑰�' + - '1.瀛﹀巻瑕佹眰锛氭湰绉戝強浠ヤ笂瀛﹀巻锛岃绠楁満绉戝涓庢妧鏈�佽蒋浠跺伐绋嬬瓑鐩稿叧涓撲笟浼樺厛锛屼紭绉�澶т笓瀛﹀巻鑰�') - .fontSize(10) - .margin({ top: 6 }) - .fontColor('#666666') - .lineHeight(15) + LvMarkdownIn({ text: item.ability }) .width('100%') - .textAlign(TextAlign.Start) + .padding({ left: 10, right: 10 }) } - - } .padding(10) .border({ width: 1, style: BorderStyle.Solid, color: this.expandIndex == index ? '#1756f4' : '#f2f2f2' }) @@ -166,8 +195,7 @@ .friction(0.6) .edgeEffect(EdgeEffect.Spring) .width('100%') - .height(560) - + .height(600) } .padding({ left: 10, right: 10 }) .height('100%') diff --git a/entry/src/main/ets/utils/config.ets b/entry/src/main/ets/utils/config.ets new file mode 100644 index 0000000..5eb1fa1 --- /dev/null +++ b/entry/src/main/ets/utils/config.ets @@ -0,0 +1 @@ +export const ROMAIN = 'http://192.168.20.70:8080' \ No newline at end of file diff --git a/entry/src/main/resources/base/media/avatar.png b/entry/src/main/resources/base/media/avatar1.png similarity index 100% rename from entry/src/main/resources/base/media/avatar.png rename to entry/src/main/resources/base/media/avatar1.png Binary files differ diff --git a/entry/src/main/resources/base/media/avatar2.png b/entry/src/main/resources/base/media/avatar2.png new file mode 100644 index 0000000..572ba0d --- /dev/null +++ b/entry/src/main/resources/base/media/avatar2.png Binary files differ diff --git a/entry/src/main/resources/base/media/avatar3.png b/entry/src/main/resources/base/media/avatar3.png new file mode 100644 index 0000000..c0ec065 --- /dev/null +++ b/entry/src/main/resources/base/media/avatar3.png Binary files differ diff --git a/entry/src/main/resources/base/media/bronze_icon.png b/entry/src/main/resources/base/media/bronze_icon.png new file mode 100644 index 0000000..26b8d1a --- /dev/null +++ b/entry/src/main/resources/base/media/bronze_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 6dbbd39..69eb206 100644 --- a/entry/src/main/resources/base/profile/main_pages.json +++ b/entry/src/main/resources/base/profile/main_pages.json @@ -13,6 +13,8 @@ "pages/message/MessageDetailsPage", "pages/account/UserInfoPage", "pages/account/LearningRecordPage", + "pages/account/CourseCollection", + "pages/account/PersonVitae", "pages/account/SettingPage", "pages/account/MessagePushPage", "pages/account/AboutPage" -- Gitblit v1.8.0