| | |
| | | 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 = '' |
| | |
| | | { 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高级:JVM深度调优与JVM深度调优', '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(){ |
| | |
| | | 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() |
| | |
| | | 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')}` }, |
| | |
| | | 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')}` }, |
| | |
| | | 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')}` }, |
| | |
| | | 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 }) |
| | | } |
| | |
| | | router.pushUrl({ |
| | | url: 'pages/home/ActiveDetail', |
| | | params: { |
| | | index: index |
| | | id: item.id |
| | | } |
| | | }) |
| | | }) |
| | |
| | | Image($r('app.media.search_icon')) |
| | | .width(14) |
| | | .height(14) |
| | | TextInput({ placeholder: '搜索想要查找的内容' }) |
| | | TextInput({ placeholder: '搜索想要查找的内容', text: $$this.searchKeyword }) |
| | | .placeholderFont({ size: 14}) |
| | | .placeholderColor('#999999') |
| | | .backgroundColor('#f3f7fe') |
| | |
| | | } |
| | | Text() { |
| | | Span('课程难度: ') |
| | | Span(`${item.difficulty}`) |
| | | Span(this.getDifficultText(item.difficulty)) |
| | | } |
| | | .fontSize(10) |
| | | .fontColor('#666666') |
| | |
| | | .friction(0.6) |
| | | .edgeEffect(EdgeEffect.Spring) |
| | | .width('100%') |
| | | .height(530) |
| | | |
| | | .height(580) |
| | | } |
| | | .height('100%') |
| | | }.tabBar(this.tabBarItem(item.title, index)) |