Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
mlaj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2025-12-29 17:56:17 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
eddce50377dbee8ceafa4257ca72683b1178657c
eddce503
1 parent
ab85032e
refactor(布局): 移除多个页面中未使用的右侧内容组件
清理未使用的RightContent组件及相关代码 移除jsx语法声明,统一使用script setup
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
84 deletions
src/views/HomePage.vue
src/views/courses/CourseDetailPage.vue
src/views/courses/CoursesPage.vue
src/views/HomePage.vue
View file @
eddce50
<!--
* @Date: 2025-03-20 19:55:21
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-12-2
7 23:41:35
* @LastEditTime: 2025-12-2
9 17:50:54
* @FilePath: /mlaj/src/views/HomePage.vue
* @Description: 美乐爱觉教育首页组件
*
...
...
@@ -29,7 +29,7 @@
-->
<template>
<AppLayout title="美乐爱觉教育"
:rightContent="rightContent"
>
<AppLayout title="美乐爱觉教育">
<div class="bg-gradient-to-b from-white via-green-50/10 to-blue-50/10">
<!-- Header Section with Welcome & Weather -->
<div v-if="currentUser" class="px-4 pt-3 pb-4">
...
...
@@ -322,7 +322,7 @@
</AppLayout>
</template>
<script setup
lang="jsx"
>
<script setup>
// 导入所需的Vue核心功能和组件
import { ref, onMounted, defineComponent, h, watch, nextTick } from 'vue'
import { useRoute } from 'vue-router'
...
...
@@ -382,30 +382,6 @@ onMounted(() => {
}, { immediate: true })
})
// 右侧导航组件:搜索和消息通知
// 右侧内容组件
const RightContent = defineComponent({
setup() {
return () => (
<div class="flex items-center">
<button class="p-2 mr-1">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-gray-700" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
</svg>
</button>
<button class="p-2">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-gray-700" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" />
</svg>
</button>
</div>
)
}
})
const rightContent = h(RightContent)
// 工具函数:处理图片加载错误,设置默认头像
const handleImageError = (e) => {
e.target.onerror = null // 防止循环触发错误
...
...
src/views/courses/CourseDetailPage.vue
View file @
eddce50
<template>
<AppLayout :
rightContent="rightContent" :
has-title="false">
<AppLayout :has-title="false">
<div class="pb-24 mb-6">
<!-- Course Image -->
<div class="mb-4">
...
...
@@ -324,7 +324,7 @@
</AppLayout>
</template>
<script setup
lang="jsx"
>
<script setup>
import { ref, onMounted, onUnmounted, defineComponent, h } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useCart } from '@/contexts/cart'
...
...
@@ -619,32 +619,6 @@ const handleImageError = (e) => {
e.target.src = ''
}
// Right content component
const RightContent = defineComponent({
setup() {
return () => (
<button class="p-2">
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6 text-gray-700"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"
/>
</svg>
</button>
)
},
})
const rightContent = h(RightContent)
/**
* @function handlePurchase
* @description 立即购买操作:
...
...
src/views/courses/CoursesPage.vue
View file @
eddce50
<template>
<AppLayout
:rightContent="rightContent"
>
<AppLayout>
<div class="pb-16">
<!-- Search Bar -->
<div class="pb-2">
...
...
@@ -93,7 +93,7 @@
</AppLayout>
</template>
<script setup
lang="jsx"
>
<script setup>
import { computed, defineComponent, h } from "vue";
import { useRoute, useRouter } from 'vue-router'
import AppLayout from "@/components/layout/AppLayout.vue";
...
...
@@ -139,31 +139,4 @@ const todayDate = new Date();
const formattedTime = featuredCourse.liveTime.split(":");
const hours = computed(() => formattedTime[0]);
const minutes = computed(() => formattedTime[1]);
// Right content component
const RightContent = defineComponent({
setup() {
return () => (
<button class="p-2">
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6 text-gray-700"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"
/>
</svg>
</button>
);
},
});
const rightContent = h(RightContent);
</script>
...
...
Please
register
or
login
to post a comment