| | |
| | | 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 { DOMAIN } from "../../utils/config" |
| | | |
| | | @Entry |
| | | @Component |
| | | export struct ClassificationDetail { |
| | | @State title: string = '' |
| | | @State moduleName: string = '' |
| | | @State content: string = '' |
| | | aboutToAppear(): void { |
| | | interface Params { |
| | | title: string |
| | | moduleName: string |
| | | } |
| | | const params = router.getParams() as Params |
| | | this.title = params.title |
| | | this.moduleName = params.moduleName |
| | | this.getDetail() |
| | | } |
| | | |
| | | getDetail() { |
| | | let httpRequest = http.createHttp(); |
| | | httpRequest.request( |
| | | `${DOMAIN}/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')}` }, |
| | | }, |
| | | (err, data) => { |
| | | console.log('response', '/home/module/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<string> |
| | | if (resData.code == 200) { |
| | | this.content = resData.data || '' |
| | | } else { |
| | | promptAction.showToast({ message: resData.msg }) |
| | | } |
| | | } |
| | | } |
| | | ) |
| | | } |
| | | |
| | | build() { |
| | |
| | | Image($r('app.media.left_icon')) |
| | | .width(20) |
| | | .height(20) |
| | | .onClick(() => { |
| | | router.back() |
| | | }) |
| | | Text('详情页') |
| | | .fontSize(18) |
| | | .fontWeight(700) |
| | |
| | | .padding(10) |
| | | .justifyContent(FlexAlign.SpaceBetween) |
| | | |
| | | Image($r('app.media.image1')) |
| | | .width('100%') |
| | | .height(180) |
| | | |
| | | Column({ space: 10 }) { |
| | | |
| | | Text('详情介绍') |
| | | if (this.moduleName) { |
| | | Image($r(`app.media.classification_detail_${this.moduleName}`)) |
| | | .width('100%') |
| | | .fontSize(14) |
| | | .fontWeight(800) |
| | | .margin({ top: 10 }) |
| | | |
| | | Text('本课程是计算机网络技术、通信技术等专业的专业核心课程,旨在培养学生的网络技术职业能力、职业素养和创新能力。' + |
| | | '\n采用项目式实训教学,通过引入一个循序渐进的企业网络组建案例,让学生在模拟真实场景中掌握中小型企业网络组建的知识和能力' + |
| | | '教材内容覆盖华为“1+X”证书考试要求,包含大量实操练习。') |
| | | .width('100%') |
| | | .fontSize(13) |
| | | .lineHeight(20) |
| | | .height(180) |
| | | } |
| | | .padding(14) |
| | | LvMarkdownIn({ text: this.content.toString() }) |
| | | .width('100%') |
| | | .height(560) |
| | | .padding({ left: 10, right: 10 }) |
| | | } |
| | | .width('100%') |
| | | .height('100%') |