diff --git a/public/icons/welcome/welcomeLeft.png b/public/icons/welcome/welcomeLeft.png new file mode 100644 index 0000000..cc4218d Binary files /dev/null and b/public/icons/welcome/welcomeLeft.png differ diff --git a/src/layout/grid/WelcomePage.tsx b/src/layout/grid/WelcomePage.tsx index 4137639..4c73ff0 100644 --- a/src/layout/grid/WelcomePage.tsx +++ b/src/layout/grid/WelcomePage.tsx @@ -1,13 +1,16 @@ -import { computed, defineComponent, onMounted, ref, Transition } from 'vue' +import { computed, defineComponent, onMounted, onUnmounted, ref, Transition } from 'vue' import WelcomeImg from '~/icons/welcome/welcomeTitle.png' import DivBgImg from '~/icons/welcome/back.png' import startUseImg from '~/icons/welcome/startUse.png' +import LeftImg from '~/icons/welcome/welcomeLeft.png' +import RightImg from '~/icons/welcome/welcomeRight.png' import useLayoutStore from '../useLayoutStore' import request from '@/utils/request' import useStatisticStore from '@/utils/useStatisticStore' import { v4 as uuid } from 'uuid' import { uploadLocal } from '@/utils/upload' import { videoArr } from '@/config' +import clsx from 'clsx' export const DefaultPageSetting = [ { name: '游戏', @@ -40,6 +43,25 @@ export default defineComponent(() => { const layout = useLayoutStore() const isFirst = ref(false) + // 创建一个响应式变量来存储屏幕宽度 + const width = ref(window.innerWidth) + + const updateWidth = () => { + width.value = window.innerWidth + } + + onMounted(() => { + // 监听窗口大小变化 + window.addEventListener('resize', updateWidth) + }) + + onUnmounted(() => { + // 组件卸载时移除事件监听器 + window.removeEventListener('resize', updateWidth) + }) + const isBig = computed(() => { + return width.value > 1700 + }) onMounted(() => { // 检查 localStorage 是否已经有访问记录 const visited = localStorage.getItem('hasVisited') @@ -86,24 +108,39 @@ export default defineComponent(() => { > 请选择您的初始模式 -
+
{DefaultPageSetting.map((item, idx) => (
{ selectMode.value = idx }} style={{ - transform: `translate(${idx === selectMode.value ? 80 : (selectMode.value === 2 && idx === 0) || selectMode.value + 1 === idx ? 219 : -52}px) scale(${ + transform: `translate(${idx === selectMode.value ? (isBig.value ? 0 : 0) : (selectMode.value === 2 && idx === 0) || selectMode.value + 1 === idx ? (isBig.value ? 460 : 152) : isBig.value ? -382 : -152}px) scale(${ idx === selectMode.value ? 1 : 0.85 })`, backgroundImage: `url('${DivBgImg}')`, backgroundSize: '100% 100%', - zIndex: selectMode.value === idx ? 10 : 0 + zIndex: selectMode.value === idx ? 10 : 0, + width: (isBig.value ? 844 : 709) + 'px', + height: (isBig.value ? 433 : 370) + 'px' }} >
{ backgroundRepeat: 'no-repeat' }} >
+ {selectMode.value !== idx ? ( + (selectMode.value === 2 && idx === 0) || selectMode.value + 1 === idx ? ( +
+ +
+ ) : ( +
+ +
+ ) + ) : null}
))}
@@ -125,9 +173,10 @@ export default defineComponent(() => { {DefaultPageSetting[selectMode.value].desct}
{ localStorage.setItem('hasVisited', 'true') isFirst.value = false @@ -145,10 +194,9 @@ export default defineComponent(() => { const affix = val.background.split('.').pop() if (!affix) return - console.log(`background${uuid()}.${affix}`); - console.log(`${res.type}`); - - + console.log(`background${uuid()}.${affix}`) + console.log(`${res.type}`) + const file = new File([res], `${uuid()}.${affix}`, { type: `${res.type}` })