forked from zhongyidian/super_video
refactor: 删除不再使用的图像文件,更新引导组件以支持垂直偏移功能
This commit is contained in:
1 parent
55f45269bd
commit
1e5422fecf
23 files changed
+326
-27
No files matched your search
File renamed without changes.
Binary file not shown.
|
Before Width: | Height: | Size: 142 KiB After Width: | Height: | Size: 147 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 142 KiB |
File renamed without changes.
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
File renamed without changes.
Binary file not shown.
|
After Width: | Height: | Size: 2.1 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
@@ -6,9 +6,12 @@
|
|||||||
:style="{ backgroundImage: getBackgroundImage(IMAGE_PATHS.GUIDE_DRAGON_BG) }"></div> -->
|
:style="{ backgroundImage: getBackgroundImage(IMAGE_PATHS.GUIDE_DRAGON_BG) }"></div> -->
|
||||||
|
|
||||||
<!-- 导学小龙UI区域 -->
|
<!-- 导学小龙UI区域 -->
|
||||||
<div class="guide-ui absolute left-16 top-1/2 transform -translate-y-1/2">
|
<div class="guide-ui absolute left-16" :style="positionStyle">
|
||||||
<!-- 主UI面板 -->
|
<!-- 主UI面板 -->
|
||||||
<div class="guide-panel" :style="{ backgroundImage: getBackgroundImage('components/box') }">
|
<div
|
||||||
|
class="guide-panel bg-no-repeat"
|
||||||
|
:style="{ backgroundImage: getBackgroundImage('components/box') }"
|
||||||
|
>
|
||||||
<!-- 标题区域 -->
|
<!-- 标题区域 -->
|
||||||
|
|
||||||
<ImgButton
|
<ImgButton
|
||||||
@@ -48,7 +51,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 小龙角色区域 -->
|
<!-- 小龙角色区域 -->
|
||||||
<div class="dragon-character absolute right-16 top-1/2 transform -translate-y-1/2">
|
<div class="dragon-character absolute right-16" :style="positionStyle">
|
||||||
<div class="dragon-container">
|
<div class="dragon-container">
|
||||||
<!-- 小龙角色图片 -->
|
<!-- 小龙角色图片 -->
|
||||||
<img :src="getStaticImage(IMAGE_PATHS.GUIDE_PERSON)" alt="导学小龙" class="dragon-image" />
|
<img :src="getStaticImage(IMAGE_PATHS.GUIDE_PERSON)" alt="导学小龙" class="dragon-image" />
|
||||||
@@ -60,6 +63,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue'
|
||||||
import { getStaticImage, getBackgroundImage, IMAGE_PATHS } from '@/utils'
|
import { getStaticImage, getBackgroundImage, IMAGE_PATHS } from '@/utils'
|
||||||
import { ImgButton } from '@/components/Button'
|
import { ImgButton } from '@/components/Button'
|
||||||
|
|
||||||
@@ -70,6 +74,8 @@ interface Props {
|
|||||||
currentStep?: number
|
currentStep?: number
|
||||||
/** 总步骤数 */
|
/** 总步骤数 */
|
||||||
totalSteps?: number
|
totalSteps?: number
|
||||||
|
/** 垂直偏移(仅Y轴),支持 number(px) 或 '10%'/'120px' */
|
||||||
|
positionOffsetY?: number | string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Emits {
|
interface Emits {
|
||||||
@@ -78,10 +84,11 @@ interface Emits {
|
|||||||
(e: 'complete'): void
|
(e: 'complete'): void
|
||||||
}
|
}
|
||||||
|
|
||||||
withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
showSkip: true,
|
showSkip: true,
|
||||||
currentStep: 1,
|
currentStep: 1,
|
||||||
totalSteps: 1
|
totalSteps: 1,
|
||||||
|
positionOffsetY: '50%'
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits<Emits>()
|
const emit = defineEmits<Emits>()
|
||||||
@@ -99,6 +106,21 @@ const handleSkip = () => {
|
|||||||
const handleContinue = () => {
|
const handleContinue = () => {
|
||||||
emit('next')
|
emit('next')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据 position 计算垂直定位类
|
||||||
|
const normalizeOffset = (value: number | string) => {
|
||||||
|
if (typeof value === 'number') return `${value}px`
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
|
const positionStyle = computed(() => {
|
||||||
|
const y = normalizeOffset(props.positionOffsetY)
|
||||||
|
// 百分比:按中心定位;px:按像素直接定位
|
||||||
|
if (typeof props.positionOffsetY === 'string' && props.positionOffsetY.includes('%')) {
|
||||||
|
return { top: y, transform: 'translateY(-50%)' }
|
||||||
|
}
|
||||||
|
return { top: y, transform: 'translateY(0)' }
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@@ -166,11 +188,11 @@ const handleContinue = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.content-text {
|
.content-text {
|
||||||
@apply text-white leading-relaxed font-bold text-4xl flex-1;
|
@apply text-white leading-normal font-bold text-4xl flex-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress-indicator {
|
.progress-indicator {
|
||||||
@apply absolute bottom-6 right-6;
|
@apply absolute bottom-6 right-10;
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress-dots {
|
.progress-dots {
|
||||||
@@ -239,17 +261,17 @@ const handleContinue = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dragon-character {
|
.dragon-container {
|
||||||
animation: float 3s ease-in-out infinite;
|
animation: float 3s ease-in-out infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes float {
|
@keyframes float {
|
||||||
0%,
|
0%,
|
||||||
100% {
|
100% {
|
||||||
transform: translateY(-50%) translateY(0);
|
transform: translateY(0);
|
||||||
}
|
}
|
||||||
50% {
|
50% {
|
||||||
transform: translateY(-50%) translateY(-10px);
|
transform: translateY(-10px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
:show-skip="currentStep < totalSteps"
|
:show-skip="currentStep < totalSteps"
|
||||||
:current-step="currentStep"
|
:current-step="currentStep"
|
||||||
:total-steps="totalSteps"
|
:total-steps="totalSteps"
|
||||||
|
:position-offset-y="props.positionOffsetY"
|
||||||
@next="handleNext"
|
@next="handleNext"
|
||||||
@skip="handleSkip"
|
@skip="handleSkip"
|
||||||
@complete="handleComplete"
|
@complete="handleComplete"
|
||||||
@@ -27,8 +28,16 @@
|
|||||||
:total-steps="totalSteps"
|
:total-steps="totalSteps"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 兼容原有的配置形式 -->
|
<!-- 兼容原有的配置形式:也包裹 GuideStepsItem,获得继续按钮 -->
|
||||||
<div v-else v-html="currentStepContent"></div>
|
<GuideStepsItem
|
||||||
|
v-else
|
||||||
|
:is-last-step="currentStep >= totalSteps"
|
||||||
|
:current-step="currentStep"
|
||||||
|
:total-steps="totalSteps"
|
||||||
|
@continue="handleNext"
|
||||||
|
>
|
||||||
|
{{ currentStepContent }}
|
||||||
|
</GuideStepsItem>
|
||||||
</template>
|
</template>
|
||||||
</GuideDragon>
|
</GuideDragon>
|
||||||
</div>
|
</div>
|
||||||
@@ -40,6 +49,7 @@
|
|||||||
import { ref, computed, useSlots, onMounted, onUnmounted, reactive } from 'vue'
|
import { ref, computed, useSlots, onMounted, onUnmounted, reactive } from 'vue'
|
||||||
import SpotlightOverlay from './SpotlightOverlay.vue'
|
import SpotlightOverlay from './SpotlightOverlay.vue'
|
||||||
import GuideDragon from './GuideDragon.vue'
|
import GuideDragon from './GuideDragon.vue'
|
||||||
|
import GuideStepsItem from './GuideStepsItem.vue'
|
||||||
|
|
||||||
interface GuideStep {
|
interface GuideStep {
|
||||||
id: string
|
id: string
|
||||||
@@ -63,6 +73,8 @@ interface Props {
|
|||||||
highlightPadding?: number
|
highlightPadding?: number
|
||||||
/** 高亮圆角,默认16 */
|
/** 高亮圆角,默认16 */
|
||||||
highlightRadius?: number
|
highlightRadius?: number
|
||||||
|
/** 垂直偏移(仅Y轴),支持 number(px) 或 '10%'/'120px' */
|
||||||
|
positionOffsetY?: number | string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Emits {
|
interface Emits {
|
||||||
@@ -78,7 +90,8 @@ const props = withDefaults(defineProps<Props>(), {
|
|||||||
autoPlayInterval: 0,
|
autoPlayInterval: 0,
|
||||||
highlightSelector: null,
|
highlightSelector: null,
|
||||||
highlightPadding: 8,
|
highlightPadding: 8,
|
||||||
highlightRadius: 16
|
highlightRadius: 16,
|
||||||
|
positionOffsetY: '50%'
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits<Emits>()
|
const emit = defineEmits<Emits>()
|
||||||
@@ -138,7 +151,7 @@ const currentStepContent = computed(() => {
|
|||||||
if (!step) return ''
|
if (!step) return ''
|
||||||
|
|
||||||
if (!step.title) {
|
if (!step.title) {
|
||||||
return `<p>${step.content}</p>`
|
return `${step.content}`
|
||||||
}
|
}
|
||||||
|
|
||||||
return `
|
return `
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<span class="guide-steps-item">
|
<span class="guide-steps-item">
|
||||||
<slot />
|
<slot />
|
||||||
<ImgButton
|
<ImgButton
|
||||||
v-if="!isLastStep"
|
v-if="currentStep !== totalSteps"
|
||||||
:image="IMAGE_PATHS.BUTTONS.CONTINUE"
|
:image="IMAGE_PATHS.BUTTONS.CONTINUE"
|
||||||
class="continue-button"
|
class="continue-button"
|
||||||
@click="handleContinue"
|
@click="handleContinue"
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ const borderRadius = props.borderRadius
|
|||||||
.spotlight-overlay {
|
.spotlight-overlay {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
pointer-events: none;
|
pointer-events: auto;
|
||||||
z-index: 100000;
|
z-index: 100000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ export interface GuideDragonProps {
|
|||||||
showSkip?: boolean
|
showSkip?: boolean
|
||||||
currentStep?: number
|
currentStep?: number
|
||||||
totalSteps?: number
|
totalSteps?: number
|
||||||
|
/** 垂直偏移(仅Y轴),支持 number(px) 或 '10%'/'120px' */
|
||||||
|
positionOffsetY?: number | string
|
||||||
}
|
}
|
||||||
|
|
||||||
// 引导步骤组件Props类型
|
// 引导步骤组件Props类型
|
||||||
@@ -19,6 +21,8 @@ export interface GuideStepsProps {
|
|||||||
autoStart?: boolean
|
autoStart?: boolean
|
||||||
keyboardNavigation?: boolean
|
keyboardNavigation?: boolean
|
||||||
autoPlayInterval?: number
|
autoPlayInterval?: number
|
||||||
|
/** 垂直偏移(仅Y轴),支持 number(px) 或 '10%'/'120px' */
|
||||||
|
positionOffsetY?: number | string
|
||||||
}
|
}
|
||||||
|
|
||||||
// 引导组件事件类型
|
// 引导组件事件类型
|
||||||
|
|||||||
@@ -43,6 +43,14 @@ const routes: RouteRecordRaw[] = [
|
|||||||
meta: {
|
meta: {
|
||||||
title: '发现与记录'
|
title: '发现与记录'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/video',
|
||||||
|
name: 'Video',
|
||||||
|
component: () => import('@/views/vlog/video/index.vue'),
|
||||||
|
meta: {
|
||||||
|
title: '视频'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ export const IMAGE_PATHS = {
|
|||||||
START: 'home/按钮/开始',
|
START: 'home/按钮/开始',
|
||||||
COMPLETE: 'home/按钮/完成',
|
COMPLETE: 'home/按钮/完成',
|
||||||
CANCEL: 'home/按钮/取消',
|
CANCEL: 'home/按钮/取消',
|
||||||
|
CLOSE: 'home/按钮/关闭',
|
||||||
//继续 continue
|
//继续 continue
|
||||||
CONTINUE: 'components/continue',
|
CONTINUE: 'components/continue',
|
||||||
//跳过 escape
|
//跳过 escape
|
||||||
@@ -104,6 +105,13 @@ export const IMAGE_PATHS = {
|
|||||||
//开始拍摄
|
//开始拍摄
|
||||||
START_FILMING: 'home/guide/action-btn'
|
START_FILMING: 'home/guide/action-btn'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
//components
|
||||||
|
COMPONENTS: {
|
||||||
|
CLOSE: 'components/close',
|
||||||
|
//返回
|
||||||
|
BACK: 'components/back'
|
||||||
|
},
|
||||||
// ai工具组镜头按钮
|
// ai工具组镜头按钮
|
||||||
AI_TOOLS_BUTTONS: {
|
AI_TOOLS_BUTTONS: {
|
||||||
BACK: 'home/ai工具组镜头/返回',
|
BACK: 'home/ai工具组镜头/返回',
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
import { getBackgroundImage, IMAGE_PATHS } from '@/utils'
|
import { getBackgroundImage, IMAGE_PATHS } from '@/utils'
|
||||||
import { ImgButton } from '@/components/Button'
|
import { ImgButton } from '@/components/Button'
|
||||||
|
|
||||||
import { ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
import { ProgressBar } from '@/components'
|
import { ProgressBar } from '@/components'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
const currentStep = ref(0)
|
const currentStep = ref(0)
|
||||||
|
|
||||||
@@ -25,6 +26,12 @@ const handleWorkClick = () => {
|
|||||||
// 处理任务取景按钮点击逻辑
|
// 处理任务取景按钮点击逻辑
|
||||||
router.push({ name: 'Work' })
|
router.push({ name: 'Work' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (route.query.key === 'video') {
|
||||||
|
currentStep.value = 1
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -51,7 +58,10 @@ const handleWorkClick = () => {
|
|||||||
class="absolute left-24 top-24"
|
class="absolute left-24 top-24"
|
||||||
:style="{ backgroundImage: getBackgroundImage(IMAGE_PATHS.VLOG.TASK_CAMERA) }"
|
:style="{ backgroundImage: getBackgroundImage(IMAGE_PATHS.VLOG.TASK_CAMERA) }"
|
||||||
>
|
>
|
||||||
<ImgButton :image="IMAGE_PATHS.VLOG.TASK_BTN" @click="handleWorkClick" />
|
<ImgButton
|
||||||
|
:image="currentStep === 1 ? IMAGE_PATHS.VLOG.TASK_BTN_OK : IMAGE_PATHS.VLOG.TASK_BTN"
|
||||||
|
@click="handleWorkClick"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 引导任务 -->
|
<!-- 引导任务 -->
|
||||||
|
|||||||
@@ -0,0 +1,139 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed, nextTick, onMounted, ref } from 'vue'
|
||||||
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
|
import ImgButton from '@/components/Button/ImgButton.vue'
|
||||||
|
import { GuideSteps } from '@/components/Guide'
|
||||||
|
import { getStaticImage, IMAGE_PATHS } from '@/utils'
|
||||||
|
import second from '@/assets/video/pzzx.mp4'
|
||||||
|
import third from '@/assets/video/gt.mp4'
|
||||||
|
import fourth from '@/assets/video/ch.mp4'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
|
const videoRef = ref()
|
||||||
|
const status = ref(false)
|
||||||
|
|
||||||
|
//引导步骤
|
||||||
|
const steps = ref([
|
||||||
|
{
|
||||||
|
id: 'step1',
|
||||||
|
content: '试着用这些方法记录身边的小事,你会发现,原来平凡的日子里有这么多值得捕捉的瞬间。'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
// 视频列表
|
||||||
|
const videoList = [second, third, fourth]
|
||||||
|
const currentVideoIndex = ref(0)
|
||||||
|
|
||||||
|
//按顺序播放
|
||||||
|
const currentVideo = computed(() => videoList[currentVideoIndex.value])
|
||||||
|
const handleVideoChange = () => {
|
||||||
|
if (currentVideoIndex.value < videoList.length - 1) {
|
||||||
|
currentVideoIndex.value++
|
||||||
|
} else {
|
||||||
|
status.value = true
|
||||||
|
steps.value = [
|
||||||
|
{
|
||||||
|
id: 'step1',
|
||||||
|
content: '已完成专业剖析,即可查看脚本'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
return
|
||||||
|
}
|
||||||
|
nextTick(() => {
|
||||||
|
if (!videoRef.value) return
|
||||||
|
videoRef.value.muted = false
|
||||||
|
videoRef.value.volume = 1
|
||||||
|
videoRef.value.play()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
router.back()
|
||||||
|
}
|
||||||
|
|
||||||
|
const image = computed(() => route.query.image as string)
|
||||||
|
const key = computed(() => route.query.key as string)
|
||||||
|
|
||||||
|
const handleClick = () => {
|
||||||
|
if (!videoRef.value) return
|
||||||
|
videoRef.value.muted = false
|
||||||
|
videoRef.value.volume = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePlay = () => {
|
||||||
|
if (!videoRef.value) return
|
||||||
|
videoRef.value.muted = false
|
||||||
|
videoRef.value.volume = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleComplete = () => {
|
||||||
|
if (key.value === 'profession') {
|
||||||
|
router.push({
|
||||||
|
name: 'Work',
|
||||||
|
query: {
|
||||||
|
key: 'work'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
name: 'Vlog',
|
||||||
|
query: {
|
||||||
|
key: 'video'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (key.value === 'idea') {
|
||||||
|
status.value = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="w-full h-full relative bg-white/10" @click="handleClick">
|
||||||
|
<ImgButton class="absolute left-4 top-4 z-10" :image="image"></ImgButton>
|
||||||
|
<ImgButton
|
||||||
|
class="absolute right-0 top-0 z-10"
|
||||||
|
:image="IMAGE_PATHS.COMPONENTS.BACK"
|
||||||
|
@click="handleClose"
|
||||||
|
/>
|
||||||
|
<div v-if="key === 'vlog'" :src="image">
|
||||||
|
<img :src="getStaticImage('work/vlog背景全屏待定')" alt="" />
|
||||||
|
</div>
|
||||||
|
<video
|
||||||
|
ref="videoRef"
|
||||||
|
v-else-if="key === 'case'"
|
||||||
|
src="@/assets/video/xyz.mp4"
|
||||||
|
controls
|
||||||
|
@play="handlePlay"
|
||||||
|
></video>
|
||||||
|
<!-- 专业剖析 -->
|
||||||
|
<video
|
||||||
|
ref="videoRef"
|
||||||
|
v-else-if="key === 'profession'"
|
||||||
|
:src="currentVideo"
|
||||||
|
controls
|
||||||
|
@play="handlePlay"
|
||||||
|
@ended="handleVideoChange"
|
||||||
|
></video>
|
||||||
|
<div v-else-if="key === 'idea'" :src="image">
|
||||||
|
<img :src="getStaticImage('work/思路提点全屏')" alt="" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 引导与高亮 -->
|
||||||
|
<GuideSteps v-if="status" :steps="steps" position-offset-y="85%" @complete="handleComplete" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
video {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
/* 核心:保持视频比例,多余部分被裁剪 */
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -44,4 +44,8 @@ const items = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
const onChange = (val: string) => emit('change', val as WorkTab)
|
const onChange = (val: string) => emit('change', val as WorkTab)
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
items
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
@@ -1,20 +1,61 @@
|
|||||||
<script lang="tsx" setup>
|
<script lang="tsx" setup>
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
import { getBackgroundImage, IMAGE_PATHS } from '@/utils'
|
import { getBackgroundImage, IMAGE_PATHS, getStaticImage } from '@/utils'
|
||||||
import { ImgButton } from '@/components/Button'
|
import { ImgButton } from '@/components/Button'
|
||||||
import WorkSideSwitcher from './components/WorkSideSwitcher.vue'
|
import WorkSideSwitcher from './components/WorkSideSwitcher.vue'
|
||||||
import { GuideSteps } from '@/components/Guide'
|
import { GuideSteps } from '@/components/Guide'
|
||||||
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
type WorkTab = 'vlog' | 'case' | 'profession' | 'idea'
|
type WorkTab = 'vlog' | 'case' | 'profession' | 'idea'
|
||||||
|
|
||||||
const selected = ref<WorkTab>('vlog')
|
const selected = ref<WorkTab>('vlog')
|
||||||
const stepIndex = ref(0)
|
const stepIndex = ref(0)
|
||||||
|
const workSideSwitcherRef = ref<InstanceType<typeof WorkSideSwitcher>>()
|
||||||
|
|
||||||
|
const status = ref(false)
|
||||||
|
|
||||||
|
//引导步骤
|
||||||
const steps = [
|
const steps = [
|
||||||
{ id: 'step1', content: '先认识 Vlog:点击右侧「1.vlog初识」继续' },
|
{
|
||||||
{ id: 'step2', content: '这是主要内容区域的边框' }
|
id: 'step1',
|
||||||
|
content:
|
||||||
|
'现在我们要一起走进 Vlog 的世界。简单说,Vlog 就是用视频记录生活的一种方式 —— 它像一本会动的日记,能把我们身边的小事、瞬间的心情,通过镜头变得生动又具体。'
|
||||||
|
},
|
||||||
|
{ id: 'step2', content: '接下来,我们就通过一个具体的案例,看看 Vlog 是怎么“捕捉美好” 的吧。' }
|
||||||
]
|
]
|
||||||
|
|
||||||
|
//切换图片
|
||||||
|
const sideSwitcherItems = ref([
|
||||||
|
{
|
||||||
|
key: 'vlog',
|
||||||
|
description: '记录身边的美好',
|
||||||
|
image: 'work/vlog初识框'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'case',
|
||||||
|
description: '美食小确幸:桂花酒酿小圆子',
|
||||||
|
image: 'work/案例背景待定'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'profession',
|
||||||
|
description: '美食小确幸:桂花酒酿小圆子',
|
||||||
|
image: 'work/案例背景待定'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'idea',
|
||||||
|
description: '美食小确幸:桂花酒酿小圆子',
|
||||||
|
image: 'work/思路提点小屏'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
//当前选中的item
|
||||||
|
const currentItem = computed(() => {
|
||||||
|
return sideSwitcherItems.value.find(item => item.key === selected.value)
|
||||||
|
})
|
||||||
|
|
||||||
const currentHighlight = computed(() =>
|
const currentHighlight = computed(() =>
|
||||||
stepIndex.value === 0 ? '.img-switch-item--vlog' : '.work-border'
|
stepIndex.value === 0 ? '.img-switch-item--vlog' : '.work-border'
|
||||||
)
|
)
|
||||||
@@ -26,6 +67,38 @@ interface SimpleStep {
|
|||||||
const handleStepChange = (_step: SimpleStep | null, index: number) => {
|
const handleStepChange = (_step: SimpleStep | null, index: number) => {
|
||||||
stepIndex.value = index
|
stepIndex.value = index
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleSideSwitcherChange = (value: WorkTab) => {
|
||||||
|
if (selected.value === value) return
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleImageClick = () => {
|
||||||
|
router.push({
|
||||||
|
name: 'Video',
|
||||||
|
query: {
|
||||||
|
image:
|
||||||
|
workSideSwitcherRef.value?.items.find(item => item.key === selected.value)?.activeImage ||
|
||||||
|
'',
|
||||||
|
key: selected.value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
router.back()
|
||||||
|
}
|
||||||
|
|
||||||
|
//状态是否完成前置
|
||||||
|
const isComplete = ref(false)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (route.query.key === 'work') {
|
||||||
|
selected.value = 'profession'
|
||||||
|
isComplete.value = true
|
||||||
|
} else {
|
||||||
|
status.value = true
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -36,6 +109,13 @@ const handleStepChange = (_step: SimpleStep | null, index: number) => {
|
|||||||
:style="{ backgroundImage: getBackgroundImage(IMAGE_PATHS.WORK.BG) }"
|
:style="{ backgroundImage: getBackgroundImage(IMAGE_PATHS.WORK.BG) }"
|
||||||
></div>
|
></div>
|
||||||
|
|
||||||
|
<!-- 关闭 -->
|
||||||
|
<ImgButton
|
||||||
|
class="absolute right-0 top-0"
|
||||||
|
:image="IMAGE_PATHS.COMPONENTS.CLOSE"
|
||||||
|
@click="handleClose"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- border图片 -->
|
<!-- border图片 -->
|
||||||
<div
|
<div
|
||||||
class="work-border absolute top-[140px] left-24 inset-0 bg-cover bg-center bg-no-repeat z-10 w-[1360px] h-[800px] p-10"
|
class="work-border absolute top-[140px] left-24 inset-0 bg-cover bg-center bg-no-repeat z-10 w-[1360px] h-[800px] p-10"
|
||||||
@@ -48,31 +128,42 @@ const handleStepChange = (_step: SimpleStep | null, index: number) => {
|
|||||||
<span
|
<span
|
||||||
class="mt-24 text-white font-bold text-6xl [text-shadow:0_2px_4px_rgba(0,0,0,0.2),0_0_6px_rgba(0,207,255,0.9),0_0_14px_rgba(0,207,255,0.7)]"
|
class="mt-24 text-white font-bold text-6xl [text-shadow:0_2px_4px_rgba(0,0,0,0.2),0_0_6px_rgba(0,207,255,0.9),0_0_14px_rgba(0,207,255,0.7)]"
|
||||||
>
|
>
|
||||||
记录身边的美好</span
|
{{ currentItem?.description }}</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<img class="rounded-[62px]" src="@/assets/images/work/image1.png" alt="" />
|
<img
|
||||||
|
@click="handleImageClick"
|
||||||
|
class="rounded-[62px] cursor-pointer"
|
||||||
|
:src="getStaticImage(currentItem?.image || '')"
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 左侧选项切换 -->
|
<!-- 左侧选项切换 -->
|
||||||
<div class="absolute right-4 top-32 z-20">
|
<div class="absolute right-4 top-32 z-20">
|
||||||
<WorkSideSwitcher
|
<WorkSideSwitcher
|
||||||
|
ref="workSideSwitcherRef"
|
||||||
v-model="selected"
|
v-model="selected"
|
||||||
@change="() => {}"
|
@change="handleSideSwitcherChange"
|
||||||
:item-class="'w-[462px] h-[142px] '"
|
:item-class="'w-[462px] h-[142px] '"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 任务取景按钮 -->
|
<!-- 任务取景按钮 -->
|
||||||
<ImgButton class="absolute right-14 bottom-10" :image="IMAGE_PATHS.WORK.TASK_BTN" />
|
<ImgButton
|
||||||
|
class="absolute right-14 bottom-10"
|
||||||
|
:image="isComplete ? IMAGE_PATHS.WORK.TASK_BTN_OK : IMAGE_PATHS.WORK.TASK_BTN"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- 引导与高亮 -->
|
<!-- 引导与高亮 -->
|
||||||
<GuideSteps
|
<GuideSteps
|
||||||
|
v-if="status"
|
||||||
:steps="steps"
|
:steps="steps"
|
||||||
:highlight-selector="currentHighlight"
|
:highlight-selector="currentHighlight"
|
||||||
:highlight-padding="12"
|
:highlight-padding="12"
|
||||||
:highlight-radius="20"
|
:highlight-radius="20"
|
||||||
@step-change="handleStepChange"
|
@step-change="handleStepChange"
|
||||||
|
position-offset-y="85%"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
Reference in new issue
Block a user