feat:新评论

This commit is contained in:
小张 2025-08-30 13:46:58 +08:00
parent 06dfacc074
commit 537a7f8fe6
2 changed files with 62 additions and 1 deletions

View File

@ -0,0 +1,28 @@
import { ApiRequest } from '../request'
// 主标题数据类型
export interface MainTitleData {
title: string
highlightText?: string
}
// 内容API
export class ContentApi {
// 获取内容 - 使用路径参数 contentKey
static async getContent(contentKey: string): Promise<any> {
try {
console.log(`🚀 调用内容APIcontentKey: ${contentKey}`)
const response = await ApiRequest.get(`/biz/index/content/${contentKey}`)
console.log('📋 内容API响应:', response)
return response
} catch (error) {
console.error(`❌ 获取内容失败contentKey: ${contentKey}`, error)
throw error
}
}
// 获取主标题内容
static async getMainTitle(): Promise<any> {
return this.getContent('main_title')
}
}

View File

@ -4,7 +4,7 @@
<section class="hero-banner">
<img :src="bannerImage" :alt="bannerAlt" class="banner-image" />
<div class="hero-content">
<h2>中小学教师人工智能素养<span>提升</span>在线学习平台</h2>
<h2>{{ mainTitle }}<span>{{ mainTitleHighlight }}</span>在线学习平台</h2>
<p>为教师量身定制帮助教师快速掌握AI技术教学应用与伦理规范赋能智慧课堂</p>
<button @click="goToCoursesPage">立即学习</button>
</div>
@ -530,6 +530,7 @@ import LoginModal from '@/components/auth/LoginModal.vue'
import RegisterModal from '@/components/auth/RegisterModal.vue'
import { enrollCourseExample } from '@/api/examples/usage'
import { CourseApi } from '@/api/modules/course'
import { ContentApi } from '@/api/modules/content'
// import { getPopularCourses } from '@/data/mockCourses'
@ -680,6 +681,37 @@ const showAdvertisement = ref(true)
//
const showFixedButtons = ref(false)
//
const mainTitle = ref('中小学教师人工智能素养')
const mainTitleHighlight = ref('提升')
const mainTitleLoading = ref(false)
//
const loadMainTitle = async () => {
try {
mainTitleLoading.value = true
console.log('🚀 开始加载主标题数据...')
const response = await ContentApi.getMainTitle()
console.log('📋 主标题API响应:', response)
if (response.code === 0 || response.code === 200) {
if (response.data) {
//
console.log('✅ 主标题数据获取成功:', response.data)
//
}
} else {
console.log('⚠️ 主标题API返回错误:', response.message)
}
} catch (error) {
console.error('❌ 加载主标题数据失败:', error)
//
} finally {
mainTitleLoading.value = false
}
}
// 广
const closeAdvertisement = () => {
showAdvertisement.value = false
@ -868,6 +900,7 @@ let scrollHandler: (() => void) | null = null
onMounted(async () => {
await courseStore.fetchCourses()
await loadMainTitle() //
//
scrollHandler = () => {